Why are you cloning instead of setting the original object? JDO will store the clone as a separate entity in the datastore.
2009/11/1 Rusty Wright <[email protected]> > > I'm trying to figure out the best way to manage root objects that are used > with different objects. For a semi concrete example, suppose you have a web > page with a drop down list of Favorite Foods, and a User object may have a > reference to a FavoriteFood, and other objects will have references to > FavoriteFood objects as well. > > It seems to me that if individual FavoriteFood objects don't change, but > the list (table) of FavoriteFood objects can grow, you could make them > Cloneable and use the clone, making it a child, for example: > > FavoriteFood fav = favoriteFoodDao.findByStringId(stringId); > user.addFavoriteFood(fav.clone()); > > Google's examples usually (always?) store the subordinate object's Key > rather than a clone of the object. > > I can see problems with using clones; even though I'm sure they won't, they > may change. Similarly, items may need to be deleted from the master > FavoriteFood list/table. There may be other problems that I haven't thought > of. > > Anyhow, I'm wondering if others have gone done this road or investigated it > and can offer advise. > > Thanks > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
