我尝试将一个属性添加到我的User类,以使其自动加载其子记录(contacts
)。
根据下面的错误,这似乎不可能,至少我尝试这样做的方式:
@Persistent(mappedBy = "user", defaultFetchGroup="true")
private List<Contact> contacts;
WARNING: Meta-data warning for com.contactly.User.contacts: The datastore does not support joins and therefore cannot honor requ
ests to place related objects in the default fetch group. The field will be fetched lazily on first access. You can modify this warn
ing by setting the datanucleus.appengine.ignorableMetaDataBehavior property in your config. A value of NONE will silence the warning.
A value of ERROR will turn the warning into an exception.
在JDO中还有其他方法吗?
答案 0 :(得分:1)
没有。 App Engine数据存储区不支持在与查询结果同时加载引用的实体。
答案 1 :(得分:0)
您是否考虑过在PM提取计划中设置最大提取深度:pm.getFetchPlan()。setMaxFetchDepth(int)?
您还可以在元数据中设置递归深度,但我还没有尝试过。
此处有更多信息:http://www.datanucleus.org/products/accessplatform/jdo/fetchgroup.html