-->
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: Hibernate throwing Stalestate Exception
PostPosted: Sun Feb 06, 2011 5:31 am 
Beginner
Beginner

Joined: Mon Sep 20, 2010 2:35 am
Posts: 20
Hi All,

I am working on a webapplication where we are using Hibernate for persisting object in the database. Here is the problem we will get an XML from third party and we need to persist this data in to the database.we can get updated XML for the same entity at later time so we need to update all records but since we getting updated XML from third party so no way they can provide us UUID for that entity. So we are using following approach check if the object is already in the database (XML have a unique value as entityid) if object is there delete the record and than save it as new object (Kind of replace mode) if object is not in the databse simple save it.

now here we are facing a serious issue.if i save the object and than in the second call we sent an updated request with object containing updated record hibernate is updating this object UUID with the object saved in the previous transcation.

Now it is able to delete the object but when we try to save the object it throwing stalestate exception since hibernate has already set the UUID for this object.

We tried to use update method but this will work till the context is same if at later stage we try to update the object than it will complain about the identifier property since in that case that will be null.

can any one help me out how to achieve this since it seems an issue with the context and hibernate internal session management.

Thanks in advance Umesh


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.