It sounds like you're reading documentation for the Low Level API. I don't use JDO, but I suspect that JDO does not have that single-parent constraint.
On Tue, Oct 13, 2009 at 8:49 PM, andreas_b <[email protected]>wrote: > > Hi all. > > I've only been working with relational databases up to now, and have > some problems with JDO. > > I seem to have some trouble grasping the basic design patterns with > POJO/JDO here. > This is probably a very basic issue, but its hard when the mind is > setup to think from an entirely different perspective :-). > > So, what I want to do here is to have child objects of the same type > referenced from different parents. > For example... > > Say we have a class Person, class CarRegister, class Car. > > A Car class with a Key. > > class Car { > > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Key key; > > ...other persistent objects... > > } > > In Person, I have a list of Car objects that the person owns. > > class Person { > > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Long id; > @Persistent > private List<Car> ownedCars; > > } > > In CarRegister, I also have a list of all Car objects registered. > > class CarRegister{ > > @PrimaryKey > @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) > private Long id; > @Persistent > private List<Car> registeredCars; > > } > > > Is this possible? The documentation seem to suggest that a key is made > up of the entity parent id and some other stuff, which should mean > that the above wouldn't work. (The key value includes the key of the > entity group parent (if any) and either the app-assigned string ID or > the system-generated numeric ID). > > I could of course save a list of keys/ids to Car objects instead, but > that to me would kind of defeat the purpose of this kind of database. > So I want a List of Car objects in both Person and CarRegister, and > they must somehow share the same objects in the database. This must be > one of the basic use cases, but I have been unable to find an optimal > solution for it. > > Thanks in advance. > > BR, Andreas > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" 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?hl=en -~----------~----~----~----~------~----~------~--~---
