我在Google App Engine for Java中使用低級API並想要獲取特定父實體的所有子實體:我如何獲取Google App Engine中的所有子實體
鑑於如下圖:
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));
這是一個已知的錯誤?有錯誤跟蹤器的鏈接嗎? – 2014-04-25 15:22:18