-->
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: Map one table per concrete class with union-subclass
PostPosted: Wed Mar 04, 2009 10:34 am 
Newbie

Joined: Thu Feb 26, 2009 2:22 pm
Posts: 9
Hi, I'm trying to solve such a problem: 2 tables, 3 classes (one abstract, 2 concrete classes). Like form documentation example:

<hibernate-mapping>
<class name=”Employee” abstract=”true”>
<id name=”id” column=”?” type=”long”>
<generator class=”native” />
</id>
<property name=”employeeName” column=”EMP_NAME” type=”string” />
<property name=”location” column=”LOCATION” type=”string” />

<union-subclass name=”RegularEmployee” table=”REG_EMP”>
<property name=”salary” column=”SALARY” />
<property name=”bonus” column=”BONUS” />
</union-subclass>

<union-subclass name=”ContractEmployee” table=”CON_EMP” >
<property name=”hourlyRate” column=”RATE” />
<property name=”perDiem” column=”PER_DIEM />
<property name=”contractPeriod” column=”CON_PERIOD” />
</union-subclass>

</class>
</hibernate-mapping>

Table REG_EMP have column 'id' (type 'serial' in postgresql, PK) and table CON_EMP have column 'id' (type 'serial' in postgresql, PK). How should I map 'id' in my mapping file (because both tables has another sequence: CON_EMP_id_seq and REG_EMP_id_seq)?


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.