Spring mongodb dbref属性是否为null?

时间:2015-08-17 14:07:01

标签: java spring mongodb

我使用的是春天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

0 个答案:

没有答案