【发布时间】:2009-06-15 22:37:19
【问题描述】:
我正在使用 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));
【问题讨论】:
标签: java google-app-engine google-cloud-datastore