You've got a few options here: 1. Use named keys. You can then use KeyFactory and KeyFactory.Builder to create an entire Key hierarchy. 2. Use KeyRange to generate a range of IDs you can use, and use this as the key of the parent entity http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyRange.html
-- Ikai On Mon, Nov 1, 2010 at 8:11 AM, Cyrille Vincey <[email protected]> wrote: > I am trying to figure out how to put 2 parent/child entities into the > mutationPool, inside a MapReduce job. > Here is my issue : in my understanding, as the mutationPool is asynchronous > , I cannot expect to get the parent entity key back from the > mutationPool.put() method. > > Or can I ? > According to you, would the following code work or not ? > > […] > //Creation of the parent entity > Entity parent = new Entity("ParentClass"); > parent.setProperty("fieldA", valueA); > *mutationPool.put(parent);* > > //Creation of the child entity > *Entity child = new Entity("ChildClass", parent.getKey()); //Q: Can I > expect that the key is returned directly after the mutationPool.put() method > ?* > child.setProperty("fieldX", valueX); > mutationPool.put(child); > […] > > From: "Ikai Lan (Google)" <[email protected]> > Reply-To: <[email protected]> > Date: Mon, 13 Sep 2010 14:15:30 -0700 > To: <[email protected]> > Subject: Re: [appengine-java] query for null <missing> properties > > You can't. Empty properties are the equivalent of unindexed properties. > You'll need to iterate over all the Entities in your datastore and update > them. The Mapper API is a very good tool for this: > > http://code.google.com/p/appengine-mapreduce/ > > On Mon, Sep 13, 2010 at 12:20 PM, Benjamin <[email protected]> wrote: > >> Brain freeze guys - >> >> I added a property to my object and persisted in the datastore. The >> older object have now have a column that when viewed in the control >> panel have a value of <missing>. I need to query those objects so i >> can update them - propname == null , propname == "" - I can't seem >> to find the right syntax for this. >> >> -- >> 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]<google-appengine-java%[email protected]> >> . >> For more options, visit this group at >> http://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. > > -- > 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]<google-appengine-java%[email protected]> > . > For more options, visit this group at > http://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.
