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)?
|