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: rolling back a pojo after update/save failed
PostPosted: Fri Apr 09, 2010 12:06 pm 
Newbie

Joined: Sat Oct 17, 2009 1:48 pm
Posts: 9
I was wondering for some advice from the pros out here. I have hibernate managed pojos in memory that are updated as needed. the process, naturally, is: i retrieve an appropriate pojo from memory, start transaction, mutate it, change some fields, etc. and then commit the transaction. however, if hibernate throws some error of some kind, the pojo ends up having stale/incorrect data. how do i handle this to ensure that the pojos always have up-to-date info?

1 solution i thought of is creating a post-commit-update, etc listener and checking if the session is dirty refreshing the pojo via session.refresh(). is this a good idea? how do i check that there was an error on this particular pojo, what do i check? session.isDirty()?

Thanks a lot for your help
Lev


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.