Now I'm confused...I thought an "unowned" relation was defined as being outside the Entity Group?
If I have entity A and entity B who are both related to each other via entity C, I was under the impression that we had to decide whether C would be part of A's group or B's group, but NOT could not all be in 1 group. Perhaps that is a JDO limitation and you are using the lower level API? For the sake of my discussion I'll assume A "owns" C and B has "unowned" relation with C. According to Max Ross from the Google GAE Persistence Video, I am under the impression that we should denormalize data in order that the application get around the absence of Join capability. So the many-to-many entity C would contain extra data for each FK to A and B such that, for example, if the application is querying C based a particular A.key...then each record found will already contain fields from B instead of just having the key only (ie C.keyB). Otherwise, for each row the app would have to turn around and query B by primaryKey...hence encurring much overhead. Have I interpreted this fashion of persistence handling correctly as you understand it? Are you using this same denormalization in your designs? On Sep 19, 11:08 am, mlenormand <[email protected]> wrote: > All the entities we are talking about are in the SAME entity group in > order to create/update them in the same transaction. In addition to > that, we declare an unowned relationship, using "Key" for example. I > want to save all my entities in the same transaction. > > On Sep 19, 5:52 pm, objectuser <[email protected]> wrote: > > > > > Because your relationships are unowned (so the objects are in > > different entity groups, right?), you wouldn't be able to save them > > all in the same transaction anyway. > > > So you're right: you'll have to save them, which means multiple > > transactions, and if one of them fails you'll have inconsistent data. > > > On Sep 19, 8: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 !- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
