Skip to content

Programatically setting a transaction to rollBack results in UnexpectedRollbackException [SPR-2231] #6921

@spring-projects-issues

Description

@spring-projects-issues

Colin Yates opened SPR-2231 and commented

http://forum.springframework.org/showthread.php?p=67566#post67566

Essentially I am using aop:config and tx:advice to mark all my controllers transaction and introspecting into hibernate backed objects. If there is a validation error, we mark the current transaction rollBack. Since upgrading (not sure whether it was introduced in 1.2.x or 2.0rc1) we are now getting the following stack trace:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
Caused by: org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:504)
at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:275)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)

It appears that neither TransactionInterceptor, nor the TransactionAspectSupport nor the transactionManager take into account whether the transaction is marked as rollback or not before committing.


Affects: 2.0 RC1

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions