我使用的是春天mongodb。我有以下实体。
@Document
public class Organization implements Serializable{
/**
*
*/
private static final long serialVersionUID = -375519278304469728L;
//id will be used for storing MongoDB _id
@Id
private String id;
private String orgId;
private String name;
private String description;
//getters and setters
}
@Document
public class OrgInstanceDetails implements Serializable {
/**
*
*/
private static final long serialVersionUID = 3508307831786555144L;
@Id
private String id;
@DBRef
private Organization organization;
private String instanceName;
private String accessKeyId;
private String secretKey;
//getters and setters
}
我有以下方法:
@Override
public List<OrgInstanceDetails> getAllOrgsDetails() {
return mongoOps.findAll(OrgInstanceDetails.class,"OrgInstanceDetails");
}
上述方法返回结果。但DBRef
属性值为null。为什么没有获得Organization
详细信息以及OrgInstanceDetails
?