-->
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.  [ 2 posts ] 
Author Message
 Post subject: Mapping Problem - Please Help
PostPosted: Wed May 05, 2004 12:34 am 
Newbie

Joined: Wed May 05, 2004 12:22 am
Posts: 5
Hello, I am pretty new to Hibernate and so far it has been smooth sailing. However, I ran into some tables I am not sure how to map, or if Hibernate can even handle this case....

Table A
---------------
id

Table B
---------------
id

Table C
----------------
id


Table Z
----------------
id
fk_id
type

Table Z_TYPE
------------------
id
description


There are 3 types of Table Z records, the type determines if the FK references Table A, Table B, or Table C. This is clearly inheritance so I have a Z superclass, and 3 subclasses (A, B, C). The fk_id is in the Z superclass. I understand how to differenciate between the 3 subclasses in hibernate. However, I am not sure how to tell it that the fk_id points to a different table in each of the cases.

My question is, can hibernate do this? Also, I can change the table structure if there is a better way to do this type of thing.

Thank you in advance for any help,
Apoptosis


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 05, 2004 12:32 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
fk_id should be merged with id in your Z table and you'll e able to map in as joined-subclasses

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.