Hi all,
We're running Hibernate 3 on Postgresql 8.
I have a set of objects in an object stored as a collection. These objects have a many-to-one with another table. When creating records in the root table (with the collection) everything seems to work OK, and I can see it binding the appropriated params for the Alert Type. However on update, it completely loses the reference to the third object, and inserts zero instead of the correct key.
The mappings look OK - but objviously something is wrong - does anyone have any suggestions?
Cheers,
Dan
The relationship is:
ACTIVITY -> ALERT(S) -> ALERT_TYPE
Code:
<!-- ACTIVITY -->
<class name="Activity" table="ACTIVITY" >
<composite-id class="com.commander.app.business.data.Activity$ActivityCompositeKey" name="compositeKey">
<key-property name="jobId" type="long" column="JOB_ID" />
<key-property name="stepId" type="long" column="STEP_ID" />
</composite-id>
<list name="alerts" table="DCP.ALERT" cascade="all">
<key>
<column name="JOB_ID"/>
<column name="STEP_ID"/>
</key>
<list-index column="ALERT_TYPE_ID"/>
<one-to-many class="com.commander.app.business.data.Alert" not-found="ignore"/>
</list>
</class>
<!-- ALERT -->
<class name="Alert" table="ALERT">
<composite-id class="com.commander.app.business.data.Alert$AlertCompositeKey" name="compositeKey">
<key-property name="jobId" column="JOB_ID" type="long"/>
<key-property name="stepId" column="STEP_ID" type="long"/>
<key-many-to-one name="alertType" class="com.commander.app.business.data.AlertType" column="ALERT_TYPE_ID" />
</composite-id>
</class>
<!-- ALERT TYPE -->
<class name="AlertType" table="ALERT_TYPE">
<id name="alertTypeId" column="ALERT_TYPE_ID" type="integer">
<generator class="sequence">
<param name="sequence">DCP.SEQ_ALERT_TYPE</param>
</generator>
</id>
<property name="alertTypeDescription" column="ALERT_TYPE_DESC" type="string" not-null="true"/>
</class>