Create a UserSkill entity with a parent key of User. Do a keysOnly
query for UserSkill objects that match your criteria, then get the
parent keys out of the UserSkill key, then do a batch get on the
parent keys. The Objectify code:
class UserSkill {
@Id Long id;
@Parent Key<User> user;
String skill; // could also be Key<Skill> skill if you model Skill entities
int ability;
}
List<Key<User>> userKeys = new ArrayList<Key<User>>();
for (Key<UserSkill> key: ofy.query(UserSkill.class).filter("skill",
"java").filter("ability >", 5).fetchKeys())
userKeys.add(key.getParent());
Collection<User> users = ofy.get(userKeys).values();
Jeff
On Tue, Mar 9, 2010 at 7:53 PM, Max <[email protected]> wrote:
> I start a new thread to recall this issue because the origin one can
> not be replied any more.
>
> http://groups.google.com/group/google-appengine-java/browse_thread/thread/4998ef3a9f2a0016/ec718da641a58ea7?lnk=gst&q=+how+to+query+objects+with+criterias+defined+in+child+entities#ec718da641a58ea7
>
> Rusty Wright suggested a list of user keys to be stored in skill
> entity. But that means only 5000 users can have the same skill.
>
> http://groups.google.com/group/google-appengine-java/browse_thread/thread/cf7ee19917c897b6/d91c7cd836d0ea2c#d91c7cd836d0ea2c
>
> Any other suggestions on this kind of problem?
>
> Many thanks,
> Max
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.