FYI, the low-level datastore has a new allocateIds function, so you can get a reference to an entity's key before writing the entity. This seems to be what you're looking for. Using unowned relationships wouldn't work because, as objectuser pointed out, your entities would all be in separate entity groups and hence you wouldn't be able to use transactions -- you would have to use owned relationships for this.
- Jason On Sat, Sep 19, 2009 at 6:47 AM, mlenormand <[email protected]>wrote: > > Hi Everybody, > > Here's my problem with JDO and unowned relationships : > > I have several entities of the same kind that are organized in a > hierarchical way, maintained with unowned relationships. > JDO can generate keys for my entities when they are written to the > datastore, but with this option, I can't know my entity's keys until > they are saved to the datastore. If I want to make a reference to an > entity A from an entity B, it seems to be impossible because at this > time I don't know A's key, that will be generated when transaction is > committed. > > One solution would be to use several transactions, each one would > persist an entity, but it's not good because I want to persist all the > entities in the same transaction. > > I know that defining keys myself could solve the problem, but maybe > there is an other solution that would be better ? > > Thank you for your help. And thank you to the GAE team for the > fantastic work you did ! > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
