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)
解决办法:
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事务管理中出现的ERRORTransactionInterceptor异常,并详细解释了其原因在于未正确处理RecordExistsException。提供了两种解决方案:一是通过注解指定回滚异常类型;二是将自定义异常继承自RuntimeException。
9123

被折叠的 条评论
为什么被折叠?



