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: alternative to re-using a session after exception
PostPosted: Fri May 08, 2009 8:46 am 
Newbie

Joined: Tue Jan 20, 2009 4:47 am
Posts: 1
Location: Switzerland
Hi all,

Given that Hibernate exceptions are not recoverable, how do you solve this common problem ?

A single session is opened in service layer. Then :

1. load an entity
2. execute some business process with this entity
3a. if success, set entity status to "Success"
3b. if any exception is thrown, set entity status to "Failed"
4. Save entity and commit

In step 3b, if we get an Hibernate exception, session cannot be reused and step 4 is not possible. But I do need to set the entity status to "Failed".

What do you suggest to solve this ? One session for the business process, and another session to set the status ? Knowing that I'm using the OpenSessionInView pattern, I think I'm gonna have fun with this one...

Thanks for your suggestions

JCG


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.