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
|