次のデータモデルがあります。
class StadiumOccupant {
String stadiumname;
String username;
}
class Friend {
String username;
String friendname;
}
スタジアムで友達でもあるすべてのユーザーを見つけたいです。私はこのようにすることができます:
List<String> friendsAtStadium;
String stadiumId = 'xyz';
List<Friend> friends = select from Friend where username = 'me';
for (Friend friend : friends) {
List<StadiumOccupant> friendAtStadium =
select from StadiumOccupant where
stadiumname = stadiumId and
username = friend.friendname;
friendsAtStadium.addAll(friendAtStadium);
}
これは、非常に少数のオブジェクトで機能します。ユーザーが一握り以上の友達を持つとすぐに、これは機能しません。アプリエンジンでこれに対する解決策はありますか? 性能の良いものは思いつきません。
ありがとう
-------- いくつかのサンプルデータ --------
Friend { john, tim }
Friend { john, mary }
Friend { mary, frank }
StadiumOccupant { abc, tim }
StadiumOccupant { abc, frank }
StadiumOccupant { abc, kim }
もし私がユーザー「john」なら、私の友達は { tim, mary } です。Stadiumname='abc' を指定してスタジアム クエリを実行すると、{ tim } が返されるはずです。