-->
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.  [ 2 posts ] 
Author Message
 Post subject: Part-time Collection in Object
PostPosted: Wed Aug 01, 2007 1:51 pm 
Beginner
Beginner

Joined: Fri Jun 10, 2005 2:22 pm
Posts: 27
I've got an interesting problem I hope someone can help me out with. I have an object that exists in two different locations simultaneously. The "home" object consists of only the base object (BasicItem, in this case). The "remote" object is identical except that it may contain a collection of override objects. Occasionally, the home objects are pushed to the remote location and synchronized carefully with the current set of objects. Here's where the trouble begins. Since the home objects do not contain the collection of overrides, they have an empty collection. So, when we push them into the database on the remote side, all of our overrides get deleted.

What I'd like to do is use the same object/mapping on both ends, but somehow be able to prevent that deletion of overrides from occurring when we're synchronizing the objects. I do understand why the delete is occuring right now (the cascade on the collection is all-delete-orphan). I just would like to find a way to temporarily suspend that action.

The subclass mapping is listed below. Any suggestions?

Thanks,
Dave

Hibernate version: 3.0.5

Code:
<subclass name="com.enttek.concessions.common.model.BasicItem" discriminator-value="B">
            
            <component name="caseSleeveUnit" class="com.enttek.concessions.common.model.CaseSleeveUnit" access="field">
               <component name="caseUnits" class="com.enttek.concessions.common.model.component.Quantity" access="field">
                  <property name="value" type="java.math.BigDecimal" update="true" insert="true" access="field"
                     column="case_units"/>
               </component>
               <component name="sleeveUnits" class="com.enttek.concessions.common.model.component.Quantity" access="field">
                  <property name="value" type="java.math.BigDecimal" update="true" insert="true" access="field"
                     column="sleeve_units"/>
               </component>
               <set name="overrides" inverse="false" cascade="all-delete-orphan" sort="unsorted" access="field">
                  <key column="basic_item_id"/>
                  <one-to-many class="com.enttek.concessions.common.model.ItemOverride"/>
               </set>
               <property name="itemId" type="string" access="field" update="false" insert="false" column="id"/>
             </component>
         </subclass>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 01, 2007 3:41 pm 
Beginner
Beginner

Joined: Fri Jun 10, 2005 2:22 pm
Posts: 27
Sorry for the bandwidth. Nevermind. I found that by altering my mappings a bit, I could solve my problem in a different way.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.