LOL.
christian wrote:
Oh and the key columns you use in the parent are not the foreign key columns you are using. They have to be the same, of course.
The fields I believe are OK in the mapping. It was XDoclet generated and I checked it against the example from the documentation for consistencies sake: The field names are going to be different between the parent PK and child FK in some cases.
<class name="eg.Parent">
<id name="id" column="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" column="id"/>
....
<many-to-one name="parent" class="eg.Parent" column="parent_id"/>
</class>
They are even the same order.
What I'm basically saying is that Hibernate should be populating the children's FK fields from the parent's composite ID. The error message indicates that this is not happening is Hibernate is in fact trying to insert a null value for CarrierCode which is definitely being set in the parent's composite id CARRIERNAME field.
Thanks,
Cory