title: Google App Engine Ancestor Query
body: <p>I am apparently confused as to how the GAE ancestor query should work. My understanding was that an ancestor query should return all descendent generations, not just immediate children. Yet if I modify the example from the Developer Guide as follows, I retrieve only the immediate children, never the grandchild. What am I missing?</p>
  
  <pre><code>        Entity person = new Entity("Person", "tom");
  
          Entity weddingPhoto = new Entity("Photo", person.getKey());
          weddingPhoto.setProperty("imageUrl",
                                   "http://domain.com/some/path/to/wedding_photo.jpg");
  
          Entity babyPhoto = new Entity("Photo", person.getKey());
          babyPhoto.setProperty("imageUrl",
                                "http://domain.com/some/path/to/baby_photo.jpg");
  </code></pre>
  
  <p>// add this grandchild:</p>
  
  <pre><code>        Entity grandbabyPhoto = new Entity("Photo", babyPhoto.getKey());
          grandbabyPhoto.setProperty("imageUrl",
                                "http://domain.com/some/path/to/grandbabyPhoto.jpg");
  
          Entity dancePhoto = new Entity("Photo", person.getKey());
          dancePhoto.setProperty("imageUrl",
                                 "http://domain.com/some/path/to/dance_photo.jpg");
  
          Entity campingPhoto = new Entity("Photo");
          campingPhoto.setProperty("imageUrl",
                                   "http://domain.com/some/path/to/camping_photo.jpg");
          getDatastore().put(
             java.util.Arrays.asList(person, weddingPhoto, babyPhoto, dancePhoto, campingPhoto));
  
          Query userPhotosQuery = new Query("Photo");
          userPhotosQuery.setAncestor(person.getKey());
  
          // This returns weddingPhoto, babyPhoto and dancePhoto, but
          // not grandbabyPhoto --- why???
          List&lt;Entity&gt; results = 
                getDatastore().prepare(userPhotosQuery).asList(
                   FetchOptions.Builder.withDefaults()); 
  </code></pre>
  
  <p>Thanks very much for any help you can provide!</p>