Does use of the default fetch group for a child entity necessarily imply an illegal join on App Engine?
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.ap开发者_开发知识库pengine.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?
No. The App Engine datastore doesn't support loading referenced entities at the same time as the results of a query.
Have you looked at setting the max fetch depth on the PM fetch plan: pm.getFetchPlan().setMaxFetchDepth(int)?
- This value specifies how far out from 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
精彩评论