Yes, there is. Code extracts from what I use are below. I trust that
this helps.


Finding an object by its Long ID
--------------------------------
This is interesting since one needs to build a key containing the
ancestor path from the object you want to find all the way back to its
entity group root.

  PersistenceManager pm = ...
  Builder kbBuilder = new KeyFactory.Builder(clClass1.getSimpleName(),
loID1);    // Root
  kbBuilder = kbBuilder.addChild(clClass2.getSimpleName(), loID2);
  ...
  kbBuilder = kbBuilder.addChild(clClassN.getSimpleName(),
loIDN);    // The class you seek
  Key key = kbBuilder.getKey();
  Object objFound = pm.getObjectById(clClassN, key);

  pm.close();


Finding an object by its encoded key string
-------------------------------------------
This is more direct since the encoded key string has the ancestor path
encoded in it. This way of doing things is less portable to outside of
Google BigTable, though, compared to finding by ID.

  PersistenceManager pm = ...
  Object objFound = pm.getObjectById(Class cl, String sEncodedKey);
  pm.close();


On Apr 6, 8:24 am, Luca Matteis <[email protected]> wrote:
> Thanks for this. But is there a way to get a specific entity using the
> "ID/Name" value generated by the data-store?

-- 
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.

Reply via email to