silpau
11-16-2007, 10:18 AM
We are using annotation driven transaction management in our application.
There are three layers
application layer -> layer1 -> layer2
application layer : PROPAGATION.REQUIRES_NEW
layer1:PROPAGATION.MANDATORY
layer2:PROPAGATION.MANDATORY
The issue we are facing is in the application layer I have to catch and process a run time exception .
But when we do that we are getting the following exception
ERROR org.codehaus.xfire.handler.DefaultFaultHandler - Fault occurred!
org.springframework.transaction.UnexpectedRollback Exception: Transaction rolled back because it has been marked as rollback-only
at org.springframework.transaction.support.AbstractPl atformTransactionManager.commit(AbstractPlatformTr ansactionManager.java:626)
at org.springframework.transaction.interceptor.Transa ctionAspectSupport.commitTransactionAfterReturning (TransactionAspectSupport.java:314)
at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:117)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :166)
so in the exception handling code we used the TransactionAspectSupport.currentTransactionStatus( ).setRollbackOnly();
This doesn't give the earlier exception but it roll backs the trx i.e. doesn't commit the changes to the DB
How can we catch the exception and at the same time commit changes to the DB.
There are three layers
application layer -> layer1 -> layer2
application layer : PROPAGATION.REQUIRES_NEW
layer1:PROPAGATION.MANDATORY
layer2:PROPAGATION.MANDATORY
The issue we are facing is in the application layer I have to catch and process a run time exception .
But when we do that we are getting the following exception
ERROR org.codehaus.xfire.handler.DefaultFaultHandler - Fault occurred!
org.springframework.transaction.UnexpectedRollback Exception: Transaction rolled back because it has been marked as rollback-only
at org.springframework.transaction.support.AbstractPl atformTransactionManager.commit(AbstractPlatformTr ansactionManager.java:626)
at org.springframework.transaction.interceptor.Transa ctionAspectSupport.commitTransactionAfterReturning (TransactionAspectSupport.java:314)
at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:117)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :166)
so in the exception handling code we used the TransactionAspectSupport.currentTransactionStatus( ).setRollbackOnly();
This doesn't give the earlier exception but it roll backs the trx i.e. doesn't commit the changes to the DB
How can we catch the exception and at the same time commit changes to the DB.