I ran across some unexpected behaviour with a bi-directional one-to-
many relationship, in adding a new child to a collection, when the
parent object was detached. I'd be interested if anyone could shed
more light on why things work the way they do.

My detached parent object appears to include full information about
the child collection— I can iterate through its set of children and
access their data.
However, I found that I had to call 'makePersistent' on the detached
parent to re-attach it *before* adding the new child to its child
collection.
If I first added the new child, then called makePersistent, the child
was not added correctly.  (It was persisted, but its key did not
incorporate the parent key, and a re-fetch of the parent did not
include the new child).  Re-attaching first fixed this issue.

I'm curious to why that is, as I had understood that modifications
made to the detached object were merged in when it was re-attached.
(and all the examples I've seen seem to support this, as they call
makePersistent after making modifications).  However, there seems to
be something subtle (to me) going on with relationship collections.

 -Amy
-- 
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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.


Reply via email to