Okey, I got the answer of, what is "Unowned relationships are not supported"
In our example it will through exception. * javax.persistence.PersistenceException: Detected attempt to establish User(2) as the parent of Role(1) but the entity identified by Role(1) has already been persisted without a parent. A parent cannot be established or changed once an object has been persisted.* *Datanucleus* Got it? Now the easiest solution to handle unowned relationships is *use aliases* as explained here http://gae-java-persistence.blogspot.com/2010/02/truth-about-joins.html But don't know why it does not work in my case http://groups.google.com/group/google-appengine-java/browse_thread/thread/aefd4e8b918af4f2 *Max*, can you please explain. I believe most of us don't know that way of managin unowned relation. Please help. On Sat, May 1, 2010 at 10:02 PM, Sudhir Ramanandi <[email protected]>wrote: > >How can it possibly identify it as an unowned relationship? You have > >references to real objects so its a real (i.e "owned") relationship. > >You have no references to keys (or object identities). > > Aah, this is the point.. I am talking about. > > - The example I gave earlier is an unowned relationship ryt? > *"Role can exist without user, user can exist without role, but user can > have one or more roles"* > > > > You have references to real objects so its a real (i.e "owned") > relationship. > > If I store real references instead of Keys' does it become *Owned*, and If > I store keys instead of *references* does it become *unowned* !!!. > > Then why would I take the trouble of unowned, I will store real references > for all the relations, and all is well. > > - The question is, *When I must use Keys (unowned) instead of references, > otherwise datastore will not support/handle it and through exception or > whatever.* > > The answer to above question will implicitly explain "What is unowned > relationship" and what is "unowned relationship is not supported"* > > Thanks > SN > > > On Sat, May 1, 2010 at 9:46 PM, datanucleus <[email protected]>wrote: > >> > *Google says "unowned relationship is not supported"* >> > What does it mean? *How datastore identify that *it is unowned >> relationship**? >> >> No idea. It's a Google special. It's not part of any spec so it's for >> them to answer. >> >> > In above example, If I implement it as normal relationship, as shown in >> > below code, What will happen?. >> > - Can datastore identify it as unowned relationship and through error? >> >> How can it possibly identify it as an unowned relationship? You have >> references to real objects so its a real (i.e "owned") relationship. >> You have no references to keys (or object identities). >> >> -- >> 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]<google-appengine-java%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/google-appengine-java?hl=en. >> >> > > > -- > Sudhir Ramanandi > http://www.ramanandi.org > -- Sudhir Ramanandi http://www.ramanandi.org -- 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.
