Joined: Mon Jul 28, 2008 1:59 am Posts: 1
|
Hi
I am using a table per class structure, where i have a parent class and 3 subclasses of the same. the hbm is like this.
<hibernate-mapping package="ABC">
<class name="A" table="A_TB" optimistic-lock="version">
<id name="id" length="36" column="ID">
<generator class="assigned" />
</id>
<discriminator column="TYPE" type="string" length="50" />
<property name ="xyz"/>
<property name="resultTypeId"/>
<subclass name="B" discriminator-value="b">
<join table="B_TB">
<key column="ID" />
<property name="PQR" type="java.lang.String"/>
</join>
</subclass>
<subclass name="C" discriminator-value="c">
<join table="C_TB">
<key column="ID" />
<property name="LMN" type="java.lang.String"/>
</join>
</subclass>
</class>
The class "B" and "C" extend "A". "A" is an abstract class. So entry in the tables could be made by only instantiating the child classes that is "B" and "C". Now for certain values of "resultTypeId" in "A" I want the entry should go only in the parent table that is "A" and not in the child table that is "B" or "C".
How can this be made possible ?
|
|