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)" <maxr+appeng...@google.com>
wrote:
> You should probably read this as 
> well:http://www.datanucleus.org/products/accessplatform_1_1/jdo/attach_det...
>
>
>
> On Fri, Nov 13, 2009 at 1:31 PM, IlyaE <ilyaelk...@gmail.com> 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 pm, "Max Ross (Google)" 
> > <maxr+appeng...@google.com<maxr%2bappeng...@google.com>
>
> > 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 <ilyaelk...@gmail.com> 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]
> > > >       �...@persistent(mappedBy = "account", defaultFetchGroup="true")
> > > >        private List<Key> projects;
>
> > > > [Project]
> > > >       �...@persistent(defaultFetchGroup="true")
> > > >        private Key account;
>
> > > > [Factory] (based off starter GAE project documentation)
> > > >    public static PersistenceManagerFactory get() {
> > > >                FetchPlan fp =
> > > > pmfInstance.getPersistenceManager().getFetchPlan();
> > > >                fp.setGroup(FetchPlan.DEFAULT);
>
> > > >        return pmfInstance;
> > > >    }
>
> > > > I'm still seeing the same null pointer exception.
>
> > > > On Nov 13, 3:28 pm, "Max Ross (Google)" 
> > > > <maxr+appeng...@google.com<maxr%2bappeng...@google.com>
> > <maxr%2bappeng...@google.com <maxr%252bappeng...@google.com>>
>
> > > > wrote:
> > > > > 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...
>
> > > > > If after reading this you're still not able to get your code working,
> > > > please
> > > > > post your model objects and your code and I can take a look.
>
> > > > > Max
>
> > > > > On Fri, Nov 13, 2009 at 11:49 AM, IlyaE <ilyaelk...@gmail.com>
> > wrote:
> > > > > > 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)" 
> > > > > > <maxr+appeng...@google.com<maxr%2bappeng...@google.com>
> > <maxr%2bappeng...@google.com <maxr%252bappeng...@google.com>>
> > > > <maxr%2bappeng...@google.com <maxr%252bappeng...@google.com> <
> > maxr%252bappeng...@google.com <maxr%25252bappeng...@google.com>>>
>
> > > > > > wrote:
> > > > > > > Presumably you have a Project in your HttpSession with a null
> > > > Account.
> > > > > >  This
> > > > > > > is most likely related to FetchGroups.  You probably want to put
> > your
> > > > > > > Project.account field in the default fetch group.  That way it
> > will
> > > > > > always
> > > > > > > be available when you close the persistence manager you used to
> > load
> > > > the
> > > > > > > Project.
>
> > > > > > > On Thu, Nov 12, 2009 at 7:29 PM, IlyaE <ilyaelk...@gmail.com>
> > wrote:
> > > > > > > > I'm seeing an odd issue when loading my jsps for the first time
> > > > (after
> > > > > > > > deployment).
>
> > > > > > > > I have an Account object that has many Projects
> > > > > > > > [Account]
> > > > > > > >       �...@persistent(mappedBy = "account")
> > > > > > > >        private List<Key> projects;
>
> > > > > > > > and on the otherside
> > > > > > > > [Project]
> > > > > > > >       �...@persistent
> > > > > > > >        private Key account;
>
> > > > > > > > Now when i first load my jsp that is forwarded from a servlet,
> > i
> > > > get a
> > > > > > > > NPE on the "Long id = p.getAccount().getId();" in this code
>
> > > > > > > >        Project p = (Project)
> > > > > > request.getSession().getAttribute("project");
> > > > > > > >        Account account = null;
> > > > > > > >        if (p != null) {
> > > > > > > >                Long id = p.getAccount().getId();
> > > > > > > >                account = pm.getObjectById(Account.class, id);
>
> > > > > > > > I know p is not null (since this code runs) and i know that it
> > is
> > > > > > > > associated with an account.
>
> > > > > > > > The really odd thing is... If i refresh the page, everything
> > works
> > > > as
> > > > > > > > expected. So this NPE only occurs after i deploy a new version
> > of
> > > > the
> > > > > > > > app, or certain files expire.
> > > > > > > > Do i need to initialize anything?
>
> > > > > > > > Thanks!
>
> > > > > > > > --
>
> > > > > > > > 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%2B
> > > > > > > >  unsubscr...@googlegroups.com><google-appengine-java%2B
> > unsubscr...@googlegroups.com><google-appengine-java%2B
> > > > unsubscr...@googlegroups.com><google-appengine-java%2B
> > > > > > unsubscr...@googlegroups.com>
> > > > > > > > .
> > > > > > > > For more options, visit this group at
> > > > > > > >http://groups.google.com/group/google-appengine-java?hl=.
>
> > > > > > --
>
> > > > > > 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%2B
> > > > > >  unsubscr...@googlegroups.com><google-appengine-java%2B
> > unsubscr...@googlegroups.com><google-appengine-java%2B
> > > > unsubscr...@googlegroups.com>
> > > > > > .
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/google-appengine-java?hl=.
>
> > > > --
>
> > > > 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%2B
> > > >  unsubscr...@googlegroups.com><google-appengine-java%2B
> > unsubscr...@googlegroups.com>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/google-appengine-java?hl=.
>
> > --
>
> > 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%2B 
> > unsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-appengine-java?hl=.

--

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