使用子实体的默认提取组是否必然意味着 App Engine 上的非法加入?
我尝试向我的 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.
Is there any other way to do this in JDO?
I tried to add a property to my User class to get it to automatically load its child records (contacts
).
According to the error below, this doesn't seem possible, at least the way I tried to do it:
@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.
Is there any other way to do this in JDO?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否考虑过在 PM 获取计划上设置最大获取深度:pm.getFetchPlan().setMaxFetchDepth(int)?
根对象 相关对象
将被获取。正值
意味着这个数
关系将从
根对象。值为 -1 意味着
不会对
抓取遍历。
您还可以在元数据中设置递归深度,但我还没有尝试过。
更多信息请参见:http://www.datanucleus.org/products/accessplatform/jdo /fetchgroup.html
Have you looked at setting the max fetch depth on the PM fetch plan: pm.getFetchPlan().setMaxFetchDepth(int)?
the root object the related objects
will be fetched. A positive value
means that this number of
relationships will be traversed from
the root object. A value of -1 means
that no limit will be placed on the
fetching traversal.
You can also set a recursion-depth in the meta-data but I haven't tried that.
More info here: http://www.datanucleus.org/products/accessplatform/jdo/fetchgroup.html
不可以。App Engine 数据存储区不支持在加载查询结果的同时加载引用的实体。
No. The App Engine datastore doesn't support loading referenced entities at the same time as the results of a query.