0
我試圖創建一個@Id
屬性與String
不同的文檔,一切都很好。春季數據Couchbase對象ID
ActorKey(key=d7471027-4bd1-40a3-8e29-5249f45beed4)
{
"name": "Emma Watson",
"_class": "com.guilherme.miguel.domain.Actor"
}
有沒有存儲的ID一樣,如果它是一個簡單的String
道:我的問題是文件存儲在桶的路上,不幸的是它與類名稱前綴? 這是爲了避免在平原查詢(簡單的查詢將強迫我用ActorKey(鍵= XXXXXXXXXXX))問題
Actor.java:
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document
public class Actor {
@Id
private ActorKey key;
private String name;
}
ActorKey.java:
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ActorKey implements Serializable {
private String key;
}
ActorRepository.java
@N1qlPrimaryIndexed
@ViewIndexed(designDoc = "actor")
public interface ActorRepository extends CouchbaseRepository<Actor, ActorKey> {
}