views:

37

answers:

1

I am trying to duplicate the pattern described in Building Scalable, Complex Apps on App Engine. I am having trouble understanding how to tell GAE that Message index is a child of Message. From google, they say that you create a child object by including it in the parent class, but this is exactly what we are trying to prevent. So how do I store an entity as a child without including it in the parent class.

+1  A: 

In the context of entity groups, 'child' means the MessageIndex's key is a descendant of the Message's key. It does not mean the MessageIndex list (or collection) is a property of the Message.

See the section titled "Creating Entities With Entity Groups" in documentation on transactions for an example of how to do this in Java. http://code.google.com/appengine/docs/java/datastore/transactions.html

Robert Kluin
In the python example he simply stores the message index immediately after he stores the message. Will that make both entries part of the same entity group?
Lumpy
No. The relationship must be defined explicitly. The section in the link I provided above gives an example of how to define an entity group.
Robert Kluin
Specifically, you need to build the child objects key from the parent's key.
Robert Kluin