-->
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: org.hibernate.StaleStateException
PostPosted: Thu Apr 21, 2005 9:31 am 
Newbie

Joined: Sat Apr 02, 2005 10:32 am
Posts: 14
I am working on very simple one-to-many relationship and I am getting the following exception. Detailed description of my work is given after the exception.
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual
row count: 0 expected: 1
at org.hibernate.jdbc.BatchingBatcher.checkRowCount(BatchingBatcher.java:88)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:74)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:154)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:226)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:137)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingE
ventListener.java:274)


<br>
My Work:


I have parent Pojo called
OrderPermitPrintsRFIDTO orderPermitPrintsRFIDTO = new OrderPermitPrintsRFIDTO();
orderPermitPrintsRFIDTO.setShipTo("XXXX");
orderPermitPrintsRFIDTO.setStreetAddress("YYYYY");
orderPermitPrintsRFIDTO.setOrderNumber(new Integer(1001));


and child object is :
OrderPermitUnitDetailPK orderPermitUnitDetailPK =
new OrderPermitUnitDetailPK(new Integer(1000),"Nagesh");
OrderPermitUnitDetail orderPermitUnitDetail
= new OrderPermitUnitDetail(orderPermitUnitDetailPK, "Nagesh", "Nag",
"test", "250", new Byte(b), "junk", "done");

orderPermitUnitDetail.setOrderPermitPrintsRFIDTO(orderPermitPrintsRFIDTO);
orderPermitPrintsRFIDTO.getOrderPermitUnitDetail().add(orderPermitUnitDetail);



and final operation:
orderPermitPrintsRFIDTO.setOrderPermitUnitDetail(orderPermitUnitDetails);
hsession.update(orderPermitPrintsRFIDTO);



hibernate mappings:
<id
name="orderNumber"
type="java.lang.Integer"
column="OrderNumber"
>
<generator class="assigned" /> <!-- Modifiedy to increment from assigned .by Nagesh .-->
</id>

<property
name="permitOrderType"
type="java.lang.String"
column="PermitOrderType"
length="20"
/>
<property
name="permitSetType"
type="java.lang.String"
column="PermitSetType"
length="20"
/>
<property
name="isAttached"
type="java.lang.Byte"
column="IsAttached"
length="1"
/>
<property
name="attachedBuildingNumber"
type="java.lang.String"
column="AttachedBuildingNumber"
length="20"
/>
<property
name="isQuickDeliveryHome"
type="java.lang.Byte"
column="IsQuickDeliveryHome"
length="1"
/>
<property
name="isEmailDeliveryType"
type="java.lang.Byte"
column="IsEmailDeliveryType"
length="1"
/>
<property
name="isPrintDeliveryType"
type="java.lang.Byte"
column="IsPrintDeliveryType"
length="1"
/>
<property
name="vendorEmailAddresses"
type="java.lang.String"
column="VendorEmailAddresses"
length="20"
/>
<!--<property
name="specialInstructions"
type="java.lang.String"
column="SpecialInstructions"
length="20"
/>-->

<!-- Associations -->

<!-- bi-directional one-to-one association to Orderpermitprintsrfi -->
<!-- <one-to-one
name="orderPermitPrintsRFIDTO"
class="com.tollbrothers.archonline.valueobjects.archdoc.OrderPermitPrintsRFIDTO"
outer-join="auto"
constrained="true"
/>-->
<!-- bi-directional many-to-one association to Foundationwallheight -->
<!-- Commented to test other relation ships.
<many-to-one
name="foundationwallheight"
class="org.ultimania.model.Foundationwallheight"
not-null="true"
>
<column name="FoundationWallHeightCode" />
</many-to-one>
-->
<!-- bi-directional many-to-one association to Foundationsystem -->
<!-- Commented to test other relation ship types.
<many-to-one
name="foundationsystem"
class="org.ultimania.model.Foundationsystem"
not-null="true"
>
<column name="FoundationSystemCode" />
</many-to-one>
-->
<!-- bi-directional one-to-many association to Orderpermitunitdetail -->
<!-- Commented to test other relation ship types.
<set
name="orderpermitunitdetails"
lazy="true"
inverse="true"
cascade="all"
>
<key>
<column name="OrderNumber" />
</key>
<one-to-many
class="org.ultimania.model.Orderpermitunitdetail"
/>
</set>
-->
</class>


For Child table:


<composite-id name="comp_id" class="OrderPermitUnitDetailPK">
<key-many-to-one name="orderNumber" class="com.tollbrothers.archonline.valueobjects.archdoc.OrderPermitUnitDetail" column="orderNumber"/>
<key-property name="tbilotNumber" type="java.lang.String" column="TBILotNumber"/>
</composite-id>

<property
name="modelId"
type="java.lang.String"
column="ModelId"
length="20"
/>
<property
name="elevationId"
type="java.lang.String"
column="ElevationId"
length="20"
/>
<property
name="blockLotSection"
type="java.lang.String"
column="BlockLotSection"
length="20"
/>
<property
name="streetAddress"
type="java.lang.String"
column="StreetAddress"
length="50"
/>
<property
name="isEnergyCalcsRequired"
type="java.lang.Byte"
column="IsEnergyCalcsRequired"
length="1"
/>
<property
name="gradeElevation"
type="java.lang.String"
column="GradeElevation"
length="20"
/>
<property
name="finishedFloorElevation"
type="java.lang.String"
column="FinishedFloorElevation"
length="20"
/>

</class>

I think, I am missing something in xml file . anybody enlighten me

Regards


Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


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.