Application exception overridden by commit exception

1577 단어 springhtml
 ERROR TransactionInterceptor:307 - Application exception overridden by commit exception
Remember only unchecked exceptions cause rollbacks in spring transactions.

What is happening is that you're catching the unchecked exception, converting it to a checked exception and then propogating it. The transaction manager does not rollback for RecordExistsException and thinks that your first transaction has succeded. Thats why it tries to save your child objects. You should annotate your service with 

  
Code:
@Transactional (rollbackFor= RecordExistsException.class)

or have your exception class extend RuntimeException.
OK, the way I read that an exception occurs and it does indeed do a commit. I would presume there must be a rollback rule defined telling it to do this.

Before Spring2.0 might look like this.

<prop key="*">PROPAGATION_REQUIRED, -com.mydomain.exception.MyException</prop>


http://www.springframework.org/docs/reference/transaction.html#transaction-declarative-txadvice-settings

좋은 웹페이지 즐겨찾기