Hi Owen,

What I do is to touch the fields I want which are not in my default
fetch group before closing the persistence manager:

@PersistenceCapable(identityType = IdentityType.APPLICATION,
 detachable = "true")
public class Thing implements Serializable
{
  private static final long serialVersionUID = 1L;

  ...

  @Persistent(mappedBy="stuffParent")
  @Element(dependent="true")
  @Order(extensions = @Extension(vendorName="datanucleus", key="list-
ordering",
   value="dtDate DESC"))
  private ArrayList<Stuff> liStuffs = new ArrayList<Stuff>();
}

...

  // Touch the array here to make the items be fetched
  ArrayList<Stuff> liStuffs = item.getStuffs();
  if (liStuffs != null)
    liStuffs.size();


Hope this helps,

Ian


On Jun 18, 4:58 am, Jeff Schnitzer <[email protected]> wrote:
> The GAE datastore doesn't support fetch groups for entity properties.
> You get back all the properties whenever you load an entity.
>
> Jeff
>
> On Thu, Jun 17, 2010 at 3:32 PM, Owen Powell <[email protected]> wrote:
> > Hello group,
>
> > How do I write a custom fetch group for my GAE project?
>
> > I have a class A that contains two fields, B and C. Sometimes I only
> > want to retrieve A + B, sometimes A + B + C. I have a feeling a custom
> > fetch group would be the answer to this (http://www.jpox.org/docs/1_1/
> > fetchgroup.html), but I'm not seeing how to do this in GAE (for
> > example, I can't seem to find any files with the JDO class metadata).
> > B and C are both direct children of A, so I don't think
> > setMaxFetchDepth helps in this case.
>
> > Any help finding the metadata or another solution would be much
> > appreciated.
>
> > Best,
>
> > ~Owen
>
> > --
> > 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 [email protected].
> > To unsubscribe from this group, send email to 
> > [email protected].
> > For more options, visit this group 
> > athttp://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to