-->
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: org.hibernate.StaleStateException:
PostPosted: Sat Sep 08, 2007 4:20 am 
Newbie

Joined: Mon May 14, 2007 9:03 am
Posts: 4
org.hibernate.StaleStateException: Batch update returned unexpected row count from update: 0 actual row count: 0 expected: 1

I have many to many relationship between tables
Travel_Group and Users.
I have a middle table also between these: UserGroupProfileInvite.

However whenever I am trying to delete a invite (a row in UserGroupProfileInvite) through the User object I am getting StaleStateException. dont know how to solve this problem!!

Here is what I do:
UserGroupProfileInvite ugi = getUserGroupProfileInvite(travelGroup,user); // get the invite between the
//travelgroup and user

user.getUserGroupProfileInvites().remove(ugi);

updateUserMatch(user); //saves the user object.

Here are the hbm entries...
User.hbm.xml
<set name="userGroupProfileInvites" inverse="true" cascade="all-delete-orphan">
<cache usage="read-write"/>
<key column="USER_ID"/>
<one-to-many class="UserGroupProfileInvite"/>
</set>

TravelGroup.hbm.xml

<set name="userGroupProfileInvites" inverse="true" cascade="all-delete-orphan">
<cache usage="read-write"/>
<key column="TRAVEL_GROUP_ID"/>
<one-to-many class="UserGroupProfileInvite"/>
</set>

UserGroupProfileInvite.hbm.xml

<many-to-one
name="user"
column="User_Id"
class="User"
not-null="false"
insert="true"
update="true"
/>

<many-to-one
name="groupProfile"
column="TRAVEL_GROUP_ID"
class="TravelGroup"
not-null="false"
insert="true"
update="true"

/>



-
Abhijit


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 10, 2007 10:05 pm 
Newbie

Joined: Wed Sep 05, 2007 6:34 pm
Posts: 13
Hi Abhijit,

Quote:
user.getUserGroupProfileInvites().remove(ugi);

updateUserMatch(user); //saves the user object.


Could you provide the code for these methods? I'm wondering if this has to do with sessions or with cascades...


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.