Hello I am a new user to hibernate like many and I wanted to ensure that I have an understanding of Hibernate 3's functionality with respect to mapping multiple tables to a single class.
Essentially, what I want to do is have a generic property class that stores a name/value pair along with several property attributes (i.e. default, timestamp, etc.)
I have two classes Class User and Class Destination that have attributes specific to each of their classes. In addition, each class has a map of these property objects.
I would expect the database to contain a User and Destination table. But in addition, I want to have a UserProperties and DestinationProperties table and have the generic Property class map to both.
I understand that entity-names are a way of mapping a single class to multiple tables but I have some questions about how and where the mapping data goes.
1. Do you specify the various entity-names in the same Property.hbm.xml mapping file?
2. We use JDK 1.4.2 and XDoclet for our annotations. How are you supposed to annotate the class to support this functionality?
3. When saving the objects will cascading know how to put the properties in the right table? For instance, if I was saving a User object do the mappings give hibernate all the information it needs to write the User object to the User table and the Set of Property objects in the User table to the UserProperties table?
4. Finally, how do you write the annotations for the getProperties() method in the User and Destination objects?
Thanks
Derek
|