Let's suppose I need to check by a key if the specified entity exists
in the datastore. What is the most proper way to achieve that?I have
the next ways:
1) datastoreservice.get(key).
2) execute keys-only query with the __key__ property: new
Query("Kind").addFilter(Entity.KEY_RESERVED_PROPERTY,
FilterOperator.EQUAL, key).setKeysOnly()
3) execute keys-only query with the ancestor key: new
Query("Kind").setAncestor(key).setKeysOnly()
I think that 2) or 3) is more efficient than 1) because we don't need
to deserialize the whole entity from the datastore, just get only
keys. But I don't have any suggestions about: 2) or 3) is more
efficient?
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.