-->
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: Prevent unnecessary updates on objects
PostPosted: Wed Dec 01, 2004 2:21 am 
Newbie

Joined: Wed Dec 01, 2004 1:58 am
Posts: 1
Hibernate version:2.1.4

I have hibernate mappings as follows:

<hibernate-mapping>

<class name="com.ebreviate.rfx.response.SurveyResponse"
table="RESPONSE">

<id name="primaryKey" column="RESPONSE_ID" type="long" unsaved-value="0">
<generator class="sequence">
<param name="sequence">response_seq</param>
</generator>
</id>
<property name="submitStatus" column="submit_status"
type="com.ebreviate.rfx.response.SubmitStatus"/>

<set name="componentResponses" inverse="true" cascade="all" lazy="true">
<key column="RESPONSE_ID"/>
<one-to-many class="com.ebreviate.rfx.response.pricing.ComponentResponse"/>
</set>


</hibernate-mapping>




<hibernate-mapping>

<class name="com.ebreviate.rfx.response.pricing.ComponentResponse"
table="PRICING_RESPONSE">

<id name="primaryKey" column="PRICING_RESPONSE_ID" type="long" unsaved-value="0">
<generator class="sequence">
<param name="sequence">pricing_response_seq</param>
</generator>
</id>

<property name="textValue" column="TEXT_VALUE" type="string"/>

<many-to-one name="response" column="RESPONSE_ID"
class="com.ebreviate.rfx.response.SurveyResponse" cascade="none"/>

<many-to-one name="component" column="COMPONENT_ID"
class="com.ebreviate.rfx.survey.pricing.ComponentNode" cascade="none"/>


</class>

</hibernate-mapping>


<hibernate-mapping>

<class name="com.ebreviate.rfx.survey.pricing.ComponentNode" table="COMPONENT">

<id name="primaryKey" column="COMPONENT_ID" type="long" unsaved-value="0">
<generator class="sequence">
<param name="sequence">component_seq</param>
</generator>
</id>

<property name="type" column="TYPE" type="com.ebreviate.rfx.survey.pricing.ComponentType"/>
<property name="status" column="STATUS" type="com.ebreviate.rfx.survey.SurveyElementStatus"/>
<property name="name" column="NAME" type="string"/>

</class>
</hibernate-mapping>

I call session.save() on SurveyResponse object.
This saves the SurveyResponse and ComponentResponse which has a cascade=all in SurveyResponse mapping.

The additional thing that happens is, it also saves ComponentNode object which creates a deadlock because all ComponentResponse objects try to save the same ComponentNode row in database.

Is there anything wrong in my mappings above. Or what else can I check to stop updation of ComponentNode object.


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.