-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Mapping multiple tables to single class
PostPosted: Fri Mar 10, 2006 9:32 pm 
Newbie

Joined: Tue Feb 07, 2006 4:56 pm
Posts: 4
Location: San Diego, CA
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.