-->
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.  [ 3 posts ] 
Author Message
 Post subject: Cancel tx in IInterceptor.BeforeTransactionCompletion?
PostPosted: Thu May 31, 2007 1:13 pm 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
Hibernate version: 1.20GA

In my implementation of IInterceptor.BeforeTransactionCompletion, if I throw an exception, the transaction is still committed and IInterceptor.AfterTransactionCompletion gets called. The transaction is marked as committed rather than rolled back.

If something goes wrong in IInterceptor.BeforeTransactionCompletion, how do I stop the transaction from committing? I am wrapping the exception in a HibernateException, since this is what the documentation says should be done for in other IInterceptor methods ...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 01, 2007 5:07 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This works as intended, exceptions thrown from BeforeTransactionCompletion are ignored. I'm not sure about the exact reason but other Java APIs seem to have this behavior as well.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 01, 2007 10:46 am 
Expert
Expert

Joined: Fri Oct 28, 2005 5:38 pm
Posts: 390
Location: Cedarburg, WI
OK. Thanks for the clarification.

We have a wrapper around NHibernate.ITransaction.Commit, so we can define our own Committing and Committed events in the wrapper and subscribe to those rather than in IInterceptor ... (sigh)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.