http://groups.google.com/group/google-appengine-java/browse_thread/thread/d907ba54c579e9ed
On Tue, Sep 22, 2009 at 8:02 AM, RoryD <[email protected]> wrote: > > I'd like to simulate using the sql IN operator in a query. > > I have 2 JDO entities in an unowned one-to-many unidirectional > relationship: > A can refer to 0 or more of B > B holds a reference to A with property of type Key "aKey" > > After a certain query on B I want to retrieve the associated A > entities. I can build up a list of Key objects, but how do I use this > to query for A? I saw in this post on stackoverflow: > > http://stackoverflow.com/questions/1003247/app-engine-datastore-in-operator-how-to-use > , > that with the low-level API, you can do a db.get(keys) and that is far > more efficient than using a query for each key. > > Is there a way to do this using the JDO API? > > I've tried using PersistenceManager.getObjectsById(Collection), but I > get the following exception: > > javax.jdo.JDOObjectNotFoundException: No such object: FailedObject:B > (3021) > > even though there is definitely a B entity with ID = 3021 in the > datastore, so I suspect this method doesn't take Keys. DataNucleus > docs say it takes Object IDs, which you can get from an existing > persistent object using PersistenceManager.getObjectId(), but there is > no method to generate one from a Key object. > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
