Thank you for replying Steve.
However I am a new hibernate user and I don't understand the <many-to-one... in your sample. It seems like the my.Entity object have a parent method?
If it was already posted could you give me the link, cause I didn't find it.
I just want to add the
parent_id column in the primary key of the child table. Below the code which inspired my code. I try many things but it doesn't work. In this code the PK contains only the
id column in the child table.
Code:
<hibernate-mapping>
<class name="eg.Parent">
<id name="id">
<generator class="sequence"/>
</id>
<set name="children" inverse="true" lazy="true">
<key column="parent_id"/>
<one-to-many class="eg.Child"/>
</set>
</class>
<class name="eg.Child">
<id name="id">
<generator class="sequence"/>
</id>
<property name="name"/>
<many-to-one name="parent" class="eg.Parent" column="parent_id" not-null="true"/>
</class>
</hibernate-mapping>