4

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));
4

2 に答える 2

3

これはローカル開発サーバーの既知のバグであることがわかりました。グーグルにアップロードするとき、それはうまくいきます

于 2009-06-17T14:27:16.783 に答える
0

getKey()プロパティではなく、メソッドではありません(、ent.getKey()ではありませんent.getKeyか?

また、とparentKey同じではありませんpe.getKey()か?

于 2009-06-15T22:47:34.493 に答える