-->
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: StaleObjectStateExcpetion
PostPosted: Sat Oct 04, 2003 2:55 pm 
Beginner
Beginner

Joined: Wed Sep 17, 2003 10:25 am
Posts: 36
I thouth I had this down but now I am seeing this error again so wanted to clearify that I understand this correctly. So any clarificaitons are appreciated.

This is what we are doing. I have an object lets say its called House. This object has a many to one relationship another object called Father :).
This relationship is bi-directional. The id for Father is auto-generated using GUID.

Now, when I want to update Father, I am sending the update to a call to update House in the following way:

updateHouse(House h){

if(h.getFather()!=null){
//we have a father
if(h.getFather().getFatherId()!=null){
//this father is being updated
session.update(h.getFather());
}else{
//this father is being created for the House
session.save(h.getFather();
}
}

//The house has other properties that could also be updated
session.update(h);
}

Now when I run this code, I get a StaleObjectStateError on the Father object telling me the following:


Problem updating House: my.package.House@2c14f9[houseId=1] and the Exception Msg is:
my.package.util.DataAccessException: Problem hibernating....net.sf.hibernate.StaleObjectStateException: Row
was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for my.package.Father instance with identifier: 402880e5f805977600f807d5f42b0004

The cascade on the relationship between House and Father is set to false. So when I call update on House, it should not cascade to Father. Not sure what's going on here but if anyone has seen this before and can point it out to me I would really appreciate it.

Thanks....


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.