-->
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.  [ 3 posts ] 
Author Message
 Post subject: Mapping object to two different tables
PostPosted: Thu Mar 24, 2005 5:00 pm 
Newbie

Joined: Thu Mar 24, 2005 4:51 pm
Posts: 2
I am a new hibernate user retro-fitting hibernate into an existing system. This is my problem:

ClassA has a one to many relationship with Something where Something is stored in a table called ClassASomethings.

ClassB has a one to many relationship with Something where Something is stored in a table called ClassBSomethings.

Since this is an existing system we would prefer not to refactor this somewhat odd situation. Rather, we would like to somehow tell hibernate that when it is perisisting ClassA that it's Somethings should be stored in table ClassASomethings, and when persisting ClassB that it's Somethings should be stored in table ClassBSomethings.

Any help is much appreciated!

Thanks

Brian


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 24, 2005 7:26 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
in H3 you can map the same class to two different tables by using different entity-names.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 25, 2005 11:24 am 
Newbie

Joined: Thu Mar 24, 2005 4:51 pm
Posts: 2
Thank you for your help. Your solution worked great.


Thanks again

Brian


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

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.