You could have a class UserProject
class UserProject {
private Key userKey;
private Key projectKey;
}
Then make User.projects a List<Project> and fill it with their projects right
after you fetch the User (and coat it with Collections.unmodifiableList() as a
reminder that it should be read only). And make User.projects transient and
not persistent. I don't know if that's a recommended approach.
bvkimball wrote:
> I have read a lot of posts with people having trouble with accessing
> the child objects of their parent but i haven't found a solution to my
> problem. So i want to have Shared objects per Users. Such as:
>
> public class User {
> private Key key;
> private String name;
> private String email;
> private List<Key> projects;
> }
>
> public class Project {
> private Key key;
> private String description
> }
>
> how would i query for all project a user has, remembering that two
> users can own the same project. Is there an equivilent to the "IN"
> statement in sql where i can just query "select from " + Project.class
> + " where key in (keyParam)", then define keyParam as a List<Key> or
> something.
>
> Anyways, i can't figure out how do this, and any help would be greatly
> appreciated.
>
> --
>
> 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=.
>
>
--
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=.