如何使用合成的对象字段生成couchbase密钥(使用\属性)
例如-我希望student(rollnumber)和branchid(branchid)作为文档的键。下面的代码在我的couchbase中保存学生文档时忽略branchid作为键
//***Student Class***
@EqualsAndHashCode
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Builder
@Document
public class Student {
@Id
@GeneratedValue(strategy = USE_ATTRIBUTES)
private String id;
@Field
private String name;
@Field
@IdAttribute(order = 1)
private long rollNumber;
@Field
private String Branch
}
//***Branch Class***
@EqualsAndHashCode
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Builder
public class Branch{
@Field
@IdAttribute(order = 2)
private String branchId;
@Field
private long branchName;
}
暂无答案!
目前还没有任何答案,快来回答吧!