Actually cards can only be owned by one deck... so that's not a problem. Deck<--1...0toN-->card.
The thing that I am looking for is a way to add new cards without loading a deck's entire card collection, and to add decks without loading a User's entire deck collection. On Mar 10, 9:15 pm, WillSpecht <willspe...@gmail.com> wrote: > The way I understand it, if an object can be owned by more than one > object it must be unowned. I would assume that cards can be in > multiple decks so they must be unowned. I would assume each deck > would belong to one user so decks could be owned. I don't know a good > way to store cards that can be queried in one query unless you have > each card store what decks they are in. This could be even more > difficult if cards appear more than once in a deck. If that is true I > would suggest a join table. > > On Mar 10, 2:20 pm, tempy <fay...@gmail.com> wrote: > > > > > I have the following datastructure: > > > "Users" are the root entities, and each "user" can have one or more > > "decks", and each deck can have one or more "cards." > > > When a user wants to add a deck, I would like to be able to add the > > deck to the user's collection of decks without first fetching all of > > the user's decks (potentially a large amount of data), then adding the > > new deck to that collection, and then persisting the user. Rather, I > > would like to simply instantiate the deck and append it to the user's > > collection of decks, without ever retrieving the entire collection. > > > Similarly, if a user wants to add a new card to an existing deck, I > > would like to add the card to the deck without first retrieving the > > entire deck (that is, the deck with all of its cards). > > > I would like to preserve the option of fetching a user with a > > populated collection of all their decks and to retrieve a deck with a > > populated collection of all its cards, which is possible with owned > > relationships. But to accomplish what I have mentioned above, would I > > be forced to use unowned relationships? (Collections of keys instead > > of collections of objects.) > > > Thanks, > > Mike -- 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.