On 25 Mar 2010, at 10:09, pman wrote:

I have gone thru the Slim3 document.

Can we have this?

@MOdel
class Parent {
 List<Child> childs = new ArrayList<Child>();
}

@Model Child {

}

If so, how to get parents based on child's property in Slim3?

Hi TQ,

Twig supports these direct relationships like this:

class Parent {
  List<Child> children;
}
class Child {
  String someProperty;
}

So no need to annotate the Model. Then you find parents based on a child property like this:

Iterator<Parent> parents = datastore.find()
  .type(Child.class)
  .addFilter("someProperty", EQUAL, "someValue")
  .returnParentsNow();

Twig is clever enough to batch get the parents using the same chunk size as the children - in this case the default is 20 at a time.

http://code.google.com/p/twig-persist/

John



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

Reply via email to