On May 4, 12:02 am, Michael Shtelma <mshte...@gmail.com> wrote:
> Hi,
>
> do you have some sort of example or tutorial for the many to many relations

No example project yet, sorry.  I plan on making some maven archetypes
in the next couple of months e.g. GWT+Guice+Sitebricks+Twig

However, Twig aims to be as unobtrusive as possible so you just code
your data models as you naturally would in Java.  A many to many is
simply:

class A
{
  List<B> bs;
}

class B
{
  List<A> as;
}

No annotations are needed here because the default behaviour is to
store all reachable instances as "independent" entities.  When you
store an A like this:

datastore.store(myA);

twig will recursively store all B's in its list and then recursively
store all A's in its list etc.  However, it will never store the same
instance twice because it keeps record of which instances are already
"associated" with the ObjectDatastore and handles the keys for you.


-- 
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