-->
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 hierarchical tables
PostPosted: Tue Jul 08, 2014 7:45 pm 
Newbie

Joined: Tue Jul 08, 2014 7:30 pm
Posts: 1
I am having difficulties mapping my class hierarchy to a table hierarchy.
I have two tables: BASE and GENE. The BASE table has a PK column and a date column while the GENE table has a name column. Since GENE table extends BASE table you will also see the two columns of the BASE table. In my Java code I have two classes: Base and Gene where Gene extends Base. The columns of the corresponding tables are attributes of the classes.
How shall I map this in Hibernate?
If I use <joined-subclass> which seems to be natural, I had to specify a key column. This makes sense if the GENE table was independent as it would have to have the PK of the BASE table as a FK. But in my case the GENE table inherits the BASE table columns. If I mapped the PK of the Base class as the key for the Gene class an insertion statement into GENE would try to first insert into the BASE table and then second into the GENE table. However, what I need is a single insert statement into the GENE table.

Is there any way doing this in Hibernate?


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.