In 1, another problem is that I may not know the Keys of A and B at the
point of creation. For example, lets say I am doing something like this:
class Person {
}
class Group {
@Persistent(mappedBy = "group")
ArrayList<Membership> memberships;
}
class Membership {
Key person;
Group group;
}
Now I would do:
Group g = new Group();
while(...) {
Membership m = new Membership();
g.memberships.add(m);
}
pm.makePersistent(g);
Now, when I create membership, I dont have the Group key (I do have the
person key), I can't really use it to create a new derived key for
membership. Or am I missing something?
On Sun, Sep 6, 2009 at 11:04 PM, Sam Walker <[email protected]> wrote:
> Lets say there is a relationship between Entities A and B, and I want to
> model it with Entity C.
>
> Two ways:
> 1. Use concatenated Key of A and B for Key of C. Data model will ensure
> there are no duplicates.
> 2. Use autogenerated Key and make sure you do not duplicate A B
> relationship in code.
>
> Which one would you choose? In 1, is a simple concatenation the best way to
> go about it?
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---