These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Updates not working, but inserts OK
PostPosted: Sun Dec 10, 2006 4:13 pm 
Newbie

Joined: Sun Dec 10, 2006 4:00 pm
Posts: 1
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>




Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.