Sorry.
Quote:
<many-to-one name="parent" cascade="save-update" class="com.Composite">
<column name="id_fk" not-null="true"/>
<column name="name_fk" not-null="true"/>
</many-to-one>
The above mapping cause errors. raise 'not-null property references a null or transient value' when it tried to add data into database. I guess, it is due to only one table being used. Haven't tested on two tables with composite-id.
and,
Quote:
<many-to-one name="parent" not-null="true" cascade="save-update" class="com.Parent">
<column name="parent_fk"/>
</many-to-one>
The above code -- don"t raise 'not-null property references a null or transient value', but a child without parent will still get inserted into database.
and,
Code:
<many-to-one name="parent" cascade="save-update" class="com.Parent">
<column name="parent_fk" not-null="true"/>
</many-to-one>
The above code works, and a child without parent will NOT get inserted into database.