Hi,
I have this class:
Code:
public class Vak
{
private String _id;
private String _name;
private List _subVakken;
private Vak _parentVak;
}
with corresponding get and set methods for all fields. The List _subVakken contains again "Vak"-objects where this Vak is then in the field _parentVak.
I have this hibernate mapping:
Code:
<hibernate-mapping>
<class name="com.misoftware.reports.models.Vak" table="VAK">
<id name="id" type="string" unsaved-value="null">
<column name="id" not-null="true"/>
<generator class="uuid.hex"/>
</id>
<property name="name" type="string"/>
<bag name="subVakken" inverse="true" lazy="true">
<key column="parentVak_id"/>
<one-to-many class="com.misoftware.reports.models.Vak"/>
</bag>
<many-to-one name="parentVak" class="com.misoftware.reports.models.Vak" column="parentVak_id"/>
</class>
</hibernate-mapping>
This does not seem to work. The List _subVakken is empty if I read the object back from hibernate if I close and re-open the session before reading.
Can someone tell me what is wrong with my mapping?
When I save the object I only call session.saveOrUpdate on the parent "Vak" (the field _parentVak is null in that case)
regards,
Wim