Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring Transaction Management to rollback the checked exception
    primarykey
    data
    text
    <p>i am working on the Spring "@Transactional" Annotation to handle the transaction.</p> <pre><code> @Transactional(readOnly = false,propagation=Propagation.REQUIRES_NEW,isolation=Isolation.READ_UNCOMMITTED,rollbackFor=SQLException.class) public void updateBatch(Report a) throws SQLException, DataAccessException { insert1();insert2(); insert3(); } </code></pre> <p>But in case</p> <ul> <li>insert1() - successfully inserts the data in table A.</li> <li>insert2() - successfully inserts the data in table b</li> <li>insert3() - throws the checked exception and does not insert data in table C</li> </ul> <p>these inserts are ibatis inbuild functions to trigger the insert in DB I got the following exception </p> <pre> "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:717) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)" </pre> <p>And the transaction would not get rolledback i.e. insert1(),insert2() does not get rollback</p> <p>Please do let me know what i am missing </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload