Google App Engine for Javaで低レベルのAPIを使用しており、特定の親エンティティのすべての子エンティティを取得したいと考えています。
次のグラフがあるとします。
Parent (1)
|
+ --- Child A (2)
| |
| + --- Child B (3)
|
+ --- Child A (4)
次のようなリストが欲しい
[Child A (2), Child B (3), Child A (4)]
これが私の最善の試みです:
Entity pe = new Entity("parent");
Entity c1 = new Entity("childA", pe.getKey());
Entity c2 = new Entity("childB", c1.getKey());
Entity c3 = new Entity("childA", pe.getKey());
// storage code left out for brevity
Key parentKey = KeyFactory.createKey(null, "parent", 1);
// According to documentation this should work (but does not)
PreparedQuery q = datastore.prepare(new Query(parentKey));