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.
|
|