It sounds good but...

Is the user supposed to be able to rollback the transaction manually at this 
point (or is the fix "only" about cases where there are bugs in user's code)? 
If so - it feels a bit strange to say to the user "If you want to rollback the 
transaction at a late stage, throw an exception in 
BeforeTransactionCompletion". As a complement to this change, it might be a 
good idea to offer some way to cancel the transaction in a friendlier way as 
well.

Maybe change the method signature to something like...

bool BeforeTransactionCompletion()

...or similar where user has a chance cancelling the transaction without 
throwing?

All the best,
Roger


From: [email protected] 
[mailto:[email protected]] On Behalf Of Oskar Berggren
Sent: den 2 december 2013 13:14
To: [email protected]
Subject: [nhibernate-development] Changed behavior: Should exceptions in 
BeforeTransactionCompletion() rollback the transaction?

Currently the session implementor etc. takes care to catch and ignore all 
exceptions raised by the  BeforeTransactionCompletion family of callbacks.
It has been suggested in NH-1082 that this behaviour is flawed and that an 
exception from the interceptor should abort the transaction. Currently we have 
a situation where something can go horribly wrong in the interceptor and yet 
the transaction would proceed.
The current behaviour of ignoring exceptions in these places is consistent with 
Hibernate, but I've been unable to find and reasoning to explain it. There have 
been various questions about it in forums, but no real reply.
I opened https://hibernate.atlassian.net/browse/HHH-8585 for Hibernate a while 
back, but these is no response so far.
Can anyone remember a reason (or think of one) for ignoring exceptions here?

Unless a reason is revealed, I suggest that NHibernate be changed so that 
exceptions in this place are not ignored, but are allowed to bubble out of and 
thus abort the commit. I'm also inclined to introduce a configuration whereby 
the old behaviour can be reinstated for backwards compatibility. I believe the 
default settings should be to not ignore exceptions, and the configuration 
option itself might be considered as immediately deprecated.


There is code provided at
https://github.com/nhibernate/nhibernate-core/pull/225

/Oskar
--

---
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/groups/opt_out.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to