Hi
I've got the following class which has a two relationships to itself.
many-to-one to its parent.
parent
one-to-many to its children.
parts
This is the cfg.xml file (which was created using the Hiberate tools)
Code:
<hibernate-mapping>
<!--
Auto-generated mapping file from
the hibernate.org cfg2hbm engine
-->
<class name="Part" table="_part">
<composite-id name="id" class="PartId">
<key-property name="partNumber" type="string">
<column name="partNumber" length="20" />
</key-property>
<key-property name="supplier" type="string">
<column name="supplier" length="20" />
</key-property>
</composite-id>
<many-to-one name="parent" class="Part">
<column name="parent_PartNumber" length="20" />
<column name="parent_Supplier" length="20" />
</many-to-one>
<property name="description" type="string">
<column name="description" length="100" />
</property>
...
...
<set name="parts" inverse="true">
<key>
<column name="parent_PartNumber" length="20" />
<column name="parent_Supplier" length="20" />
</key>
<one-to-many class="Part"/>
</set>
</class>
</hibernate-mapping>
What is basically happening when the Part class is created the
many-to-one relationship
parent is correctly created.
But for the parts
(all the children for this part) the
set is not populated.
Any help appriciated.