I have a 3 level heirarchy that is basically a Parent Class, a Child Class (which adds additional variables to the Parent), and a Grandchild (which is really more of a sibling, but the code extends from the Child...it is just a special version of the Child, does not add any variables).
I created the parent class, and then used the <joined-subclass> to create a child class. Now I am trying to create a subclass of that and I can't figure out how. I know that hibernate does not support the mixing of subclass and joined-subclass, but I can not even create a joined-subclass grandchild. Is there another way of doing this? Here are my hbm.xml files:
Parent:
Code:
<hibernate-mapping>
<class name="com.xxxxx.model.Entity" table="tbl_entity" catalog="mydb">
<id name="objectID" type="string">
<column name="objectid" />
<generator class="assigned" />
</id>
<discriminator column="class_type" type="string"/>
<property name="objectURI" type="string">
<column name="uri" length="1024" />
</property>
<property name="parentURI" formula="( SELECT DISTINCT e.uri FROM tbl_entity e WHERE e.objectid = parent_id )"/>
<property name="copy" type="string">
<column name="copy" length="45" />
</property>
<property name="move" type="string">
<column name="move" length="45" />
</property>
<property name="completionStatus" type="string">
<column name="completionStatus" length="45" />
</property>
<property name="percentComplete" type="java.lang.Integer">
<column name="percentComplete" />
</property>
</class>
</hibernate-mapping>
Child:
Code:
<hibernate-mapping>
<joined-subclass name="com.xxxxx.model.Container" table="tbl_container" extends="com.xxxxx.model.Entity">
<key column="objectid"/>
<property name="containerSnapshot" type="string">
<column name="snapshot" length="45" />
</property>
</joined-subclass>
</hibernate-mapping>
Grandchild:
Code:
<hibernate-mapping>
<joined-subclass name="com.xxxxx.model.RootContainer" table="tbl_rootcontainer" extends="com.xxxxx.model.Container">
<key column="objectid"/>
</joined-subclass>
</hibernate-mapping>
I believe my problem is
extends="com.xxxxx.model.Container" because I can change the Grandchild to extend Entity, but then I don't get my Container fields...