Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Philippe Marschall opened SPR-15749 and commented
Most places in spring-tx treat RuntimeException and Error equally rolling back in both cases as both of them are unchecked. This can be seen in TransactionAspectSupport. completeTransactionAfterThrowing and DefaultTransactionAttribute. rollbackOn
RuntimeException
Error
The execution path for CallbackPreferringPlatformTransactionManager seems to be different https://github.com/spring-projects/spring-framework/blob/master/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java#L319 where an Error is not thrown but instead wrapped in a ThrowableHolderException. However looking at the code in UOWActionAdapter.run (used by the only present implementation of CallbackPreferringPlatformTransactionManager) any kind of Throwable seems to cause a rollback. It seems to me as if RuntimeException and Error should be treated equally in the CallbackPreferringPlatformTransactionManager path in TransactionAspectSupport.java
CallbackPreferringPlatformTransactionManager
ThrowableHolderException
Throwable
TransactionAspectSupport.java
Affects: 4.3.9
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Philippe Marschall opened SPR-15749 and commented
Most places in spring-tx treat
RuntimeException
andError
equally rolling back in both cases as both of them are unchecked. This can be seen in TransactionAspectSupport. completeTransactionAfterThrowing and DefaultTransactionAttribute. rollbackOnThe execution path for
CallbackPreferringPlatformTransactionManager
seems to be differenthttps://github.com/spring-projects/spring-framework/blob/master/spring-tx/src/main/java/org/springframework/transaction/interceptor/TransactionAspectSupport.java#L319
where an
Error
is not thrown but instead wrapped in aThrowableHolderException
. However looking at the code in UOWActionAdapter.run (used by the only present implementation of CallbackPreferringPlatformTransactionManager) any kind ofThrowable
seems to cause a rollback. It seems to me as ifRuntimeException
andError
should be treated equally in theCallbackPreferringPlatformTransactionManager
path inTransactionAspectSupport.java
Affects: 4.3.9
The text was updated successfully, but these errors were encountered: