Hello All,
I am having trouble mapping superclass/subclass relationship.
Code:
class abstract SuperNode {
int id;
}
class SubNode extends SuperNode {
SuperNode nodeL;
SuperNode nodeR;
}
How do I map nodeL and nodeR in SubNode?If I use <one-to-one> mapping then it will hold reference to its SuperNode PK, but I would want to see SubNode table with having 2 columns each for nodeL and nodeR or a join table....how can i approach this situation?
I am using table per subclass approach (<joinded-subclass>)
Code:
<hibernate-mapping>
<class name="SuperNode" table="SuperNode">
<id name="id" type="integer" column="id">
<generator class="assigned"></generator>
</id>
<joined-subclass name="SubNode" table="SubNode">
<key column="id"></key>
</joined-subclass>
</class>
</hibernate-mapping>
thanks all in advance
-kashyup