What you'll want to do is to retrieve the object before closing the
PersistenceManager and storing it into request scope. That is:

PersistenceManager pm = PMF.get().getPersistenceManager();
MyUser u = pm.get // .. some retrieval code;
u.getContactInfo();
pm.close();

We'll be changing this behavior in an upcoming release so that embedded
objects, text, blob and list fields that are not retrieved by default will
be retrieved on a fetch.

On Wed, Nov 18, 2009 at 11:41 AM, IlyaE <ilyaelk...@gmail.com> wrote:

> Running into another issue. So i'm detaching my object and passing it
> along in a session.
>
> I'm now getting this error WARNING:
> javax.jdo.JDODetachedFieldAccessException: You have just attempted to
> access field "contactInfo" yet this field was not detached when you
> detached the object. Either dont access this field, or detach it when
> detaching the object.
>
> my contactInfo is an embedded persistent object in the object i am
> detaching.
>        @Embedded
>        @Persistent
>        private ContactInfo contactInfo;
>
> If i make contactInfo @Persistent(defaultFetchGroup="true") then i get
> this error.
> WARNING: The datastore does not support joins and therefore cannot
> honor requests to place child objects in the default fetch group.  The
> field will be fetched lazily on first access.  You can modify this
> warning by setting the datanucleus.appengine.ignorableMetaDataBehavior
> property in your config.  A value of NONE will silence the warning.  A
> value of ERROR will turn the warning into an exception.
>
> What is the correct way of making sure this embedded object is also
> detached when i save it to the session?
>
> On Nov 14, 6:37 am, datanucleus <andy_jeffer...@yahoo.com> wrote:
> > What state is the object in when you access its field ? (Call
> > JDOHelper.getObjectState(obj)).
> > Since no transaction boundaries or PM lifecycle is presented, it's
> > hard to guess. If you leave the object to become "transient" then it
> > will likely have its field values nulled when leaving the transaction/
> > PM (unless you bothered setting javax.jdo.option.RetainValues)
>
> --
>
> 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<google-appengine-java%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
>


-- 
Ikai Lan
Developer Programs Engineer, Google App Engine

--

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=.


Reply via email to