[appengine-java] Re: hard time modeling my database

2011-02-08 Thread WillSpecht
So you are worried that a user will be deleted and his key will still be linked to the book? You can't rely on the database to do that work for you. You can do this two ways, worry about it, and when you delete a user, make sure you delete it's key from every book. Or don't worry about it. If y

[appengine-java] Re: hard time modeling my database

2011-02-07 Thread Arjan
Will, Thanks for the hint. When i use the User key (a String) as the reference from the Book to the User object, that would mean that the referential integrity is not enforced by the database. I understand that it would work, but it feels kind of strange. Is there a way to maintain the referenti

[appengine-java] Re: hard time modeling my database

2011-02-06 Thread WillSpecht
You want to store the Key of the User not the actual User. If you store the User you are creating an owned relationship. This means that the user can only be owned by one book. What you want is an unowned relationship, which means storing the keys. Then your query stays the same except you will