Thanks Jeff,

If I would like to find all users that have java level > 5 and c++
level > 2, then how to write a query in your suggested data model?

Best regards,
Max

On Mar 10, 12:18 pm, Jeff Schnitzer <j...@infohazard.org> wrote:
> 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 <thebb...@gmail.com> 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/th...
>
> > 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/th...
>
> > 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 google-appengine-j...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > google-appengine-java+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://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 google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to