You can declare a field to be in the default fetch group if you always want
the field to be available:

@Persistent(defaultFetchGroup = "true")
private List<Value> values;

If you don't want to go with this approach, you can also "touch" the field
that you want (e.g. call item.getItemValues()) before calling pm.close.
After detaching the object, the values field will be available since they
will have been lazily fetched with the getter call.

- Jason

On Mon, Sep 14, 2009 at 11:47 AM, bysse <erik.byst...@gmail.com> wrote:

>
> Clearly i'm just as lost now as before....
>
> On Sep 14, 7:54 pm, bysse <erik.byst...@gmail.com> wrote:
> > Okej, i've learned a bit more since i've posted these messages. I
> > didn't quite understand (still don't probably) fetchgroups and detach
> > enough.
> >
> > Anyway, the problem i had with could be avoided by defining fetch
> > groups for fields that will be stored in different "tables".
> > If i have a declaration like this:
> >
> > @PersistenceCapable(identityType = IdentityType.APPLICATION,
> > detachable = "true")
> > @FetchGroup(name = "ItemValues", members = { @Persistent(name =
> > "values") })
> > public class Item implements Serializable {
> >    //...
> >    @Persistent
> >    private Set<Value> values;
> >    // ...
> >
> > }
> >
> > And i want to get an entity from the datastore including the field
> > values. I have to the FetchGroup "ItemValues" to the FetchPlan:
> >
> > pm.setDetachAllOnCommit(true);
> > pm.getFetchPlan().addGroup("ItemValues");
> > Query query = pm.newQuery(Item.class);
> > ...
> >
> > This way all the basic fields and the field values will be filled when
> > the query returns.
> >
> > On Aug 14, 6:23 pm, bysse <erik.byst...@gmail.com> wrote:
> >
> > > Ah true, i had a call to pm.setDetachAllOnCommit(true) that i didn't
> > > see.
> > > It's a bit disturbing that i can't pinpoint the error, i'll continue
> > > on this thread if it pops up again.
> >
> > > thanks a lot for your answers
> >
> > > On Aug 14, 6:03 pm, datanucleus <andy_jeffer...@yahoo.com> wrote:
> >
> >
> >
>

--~--~---------~--~----~------------~-------~--~----~
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-java@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