Option 2 looks nice.
Than you Ikai.

From:  "Ikai Lan (Google)" <ikai.l+gro...@google.com>
Reply-To:  <google-appengine-java@googlegroups.com>
Date:  Mon, 1 Nov 2010 15:28:54 -0700
To:  <google-appengine-java@googlegroups.com>
Subject:  Re: [appengine-java] Mapreduce, mutationPool, and child entities

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 <crll...@gmail.com> 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)" <ikai.l+gro...@google.com>
> Reply-To:  <google-appengine-java@googlegroups.com>
> Date:  Mon, 13 Sep 2010 14:15:30 -0700
> To:  <google-appengine-java@googlegroups.com>
> 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 <bsaut...@gmail.com> 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 google-appengine-j...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine-java+unsubscr...@googlegroups.com
>> <mailto:google-appengine-java%2bunsubscr...@googlegroups.com> .
>> 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 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.
> 
> -- 
> 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
> <mailto:google-appengine-java%2bunsubscr...@googlegroups.com> .
> 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 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.


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