Re: [appengine-java] Re: NullPointer on key

2009-11-19 Thread Ikai L (Google)
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 behavio

[appengine-java] Re: NullPointer on key

2009-11-18 Thread IlyaE
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 a

[appengine-java] Re: NullPointer on key

2009-11-14 Thread datanucleus
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

[appengine-java] Re: NullPointer on key

2009-11-13 Thread IlyaE
Right now when i set a detached copy of the object in session, it works as intented. req.getSession().setAttribute("account", pm.detachCopy(project)); Now do i still need to call fp.setGroup(FetchPlan.DEFAULT); or is this repetitive? On Nov 13, 4:48 pm, "Max Ross (Google)" wrote: > You should

Re: [appengine-java] Re: NullPointer on key

2009-11-13 Thread Max Ross (Google)
You should probably read this as well: http://www.datanucleus.org/products/accessplatform_1_1/jdo/attach_detach.html On Fri, Nov 13, 2009 at 1:31 PM, IlyaE wrote: > I'm not detaching the object. Should i be? Do i still need modified > fetching code if i use detached objects? > > On Nov 13, 4:23

[appengine-java] Re: NullPointer on key

2009-11-13 Thread IlyaE
I'm not detaching the object. Should i be? Do i still need modified fetching code if i use detached objects? On Nov 13, 4:23 pm, "Max Ross (Google)" wrote: > Can you please post the code where you're actually detaching the Project > object? > > > > On Fri, Nov 13, 2009 at 1:15 PM, IlyaE wrote: >

Re: [appengine-java] Re: NullPointer on key

2009-11-13 Thread Max Ross (Google)
Can you please post the code where you're actually detaching the Project object? On Fri, Nov 13, 2009 at 1:15 PM, IlyaE wrote: > It seems rather simple enough but i still cannot get it working > correctly. I set the annotations in my classes and modified the PM > factory > > [Account] >@

[appengine-java] Re: NullPointer on key

2009-11-13 Thread IlyaE
It seems rather simple enough but i still cannot get it working correctly. I set the annotations in my classes and modified the PM factory [Account] @Persistent(mappedBy = "account", defaultFetchGroup="true") private List projects; [Project] @Persistent(defaultFetchGroup="

Re: [appengine-java] Re: NullPointer on key

2009-11-13 Thread Max Ross (Google)
That sounds like a good topic for a Snippets That Work blog post. I don't have time to construct the example for you but I'd recommend reading http://www.datanucleus.org/products/accessplatform_1_1/jdo/fetchgroup.html If after reading this you're still not able to get your code working, please p

[appengine-java] Re: NullPointer on key

2009-11-13 Thread IlyaE
Max, Can you please provide an example of how to set the Account in a fetch group? What about detaching the entire Project object and then saving it in the session? On Nov 13, 1:50 pm, "Max Ross (Google)" wrote: > Presumably you have a Project in your HttpSession with a null Account.  This > is