Datanucleus mongodb 引用

Datanucleus mongodb references

我可以通过 DBRef 获取字段吗? 我必须将单独的集合映射到:

@PersistenceCapable(table = "group")
public class MyGroup
{
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY, column = "_id")
    private String id;
    private String name;
    private Person person;

    // getters/setters
    ...
}

@PersistenceCapable(table = "people")
public class Person
{
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY, column = "_id")
    private String id;
    private String firstName;
    private String lastName;

    // getters/setters
    ...
}

我想获取人名(目前我得到的人为空):

MyGroup myGroup = persistenceManager.getObjectById(MyGroup.class, "5230a918ac8c95fd3d9a3dfa")
myGroup.getPerson().getFirstName();

并执行查询:

Query query = persistenceManager.newQuery(MyGroup.class);
query.setFilter("persone.firstName == \"Tester\"");

DataNucleus 不支持 MongoDB 数据存储上的 DBRef: http://www.datanucleus.org/servlet/forum/viewthread_thread,7924#38188