-->
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.  [ 3 posts ] 
Author Message
 Post subject: extra delete when udating component
PostPosted: Wed Dec 17, 2003 11:37 am 
Regular
Regular

Joined: Thu Aug 28, 2003 10:54 am
Posts: 67
I have mapped a componenet as

Code:
<component name="coverSheet" class="com.lab.model.quote.CoverSheet">
  <parent name="quoteRequest"/>
  <component name="statusCode" class="com.lab.model.StatusCode">
      <property name="code" column="status_code"/>
  </component>
         
     <property name="notes" column="notes"/>       
     <property name="lastStatusChangeTime" type="timestamp" column="last_status_change_time"/>
     <property name="lastStatusCheckTime" type="timestamp" column="last_status_check_time"/>

     <map name="actions" table="coversheets" lazy="true">
           <key column="request_id"/>
           <index column="action_id" type="com.lab.model.coversheet.actions.CoverSheetAction"/>
              <composite-element class="com.lab.model.Change">
                 <many-to-one name="initiator" class="com.lab.model.employee.Employee" column="employee_id"/>
                 <property name="timeStamp" column="timestamp" type="timestamp"/>
              </composite-element>
           </map>
       </component>


Initially the map actions has no entries in the table so hibernate sets it to null. When I create a new action, I check whether the map is null and if it is create a new HashMap. When hibenate persists the change it issues a delete before inserting the new entries. After that it works as expected.

My question - is there any way to stop the initial delete. It can't do any harm as there are no entries to delete but it still bothers me.

thank you


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 11:41 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Quote:
Initially the map actions has no entries in the table so hibernate sets it to null.


No it doesn't. You set it to null.

Quote:
My question - is there any way to stop the initial delete.


Sure. You should represent "no entries" as an empty Map, instead of null.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 17, 2003 12:05 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 10:54 am
Posts: 67
yep, it was me overwriting the empty map


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

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.