Application exception overridden by commit exception

 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

你可能感兴趣的:(spring,html)