Hi
I use declarative transaction to handle my transactions.I have two different datasource and I use chained transaction manager.
In My Datasource1's table has a unique constraint in database level.I send two different entities each datasource and they pass but after the method I hit database contraint I got error.When I check transactions datasource2.save inserted db and not rollback.,but I got error in my method and my expectation is rollback all transactions,but not working
I also try Propagation.REQUIRED,Propagation.REQUIRES_NEW,saveflush vs...etc,but cant solve the issue
My Spring version:2.2.2
"org.springframework.transaction.HeuristicCompletionException: Heuristic completion: outcome state is mixed; nested exception is org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [MYSCHEMA.UNIQUE_NAME]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement\r\n\tat org.springframework.data.transaction.ChainedTransactionManager.commit(ChainedTransactionManager.java:177)\r\n\tat org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:619)\r\n\tat
@Transactional(isolation = Isolation.READ_COMMITTED, transactionManager = "MychainedTransactionManager", propagation = Propagation.REQUIRES)
public void saveMultipleDBSource() {
DataSource1.Save(); //unique constraint in db level
Datasource2.Save();
}
Comment From: snicoll
Thanks for the report but ChainedTransactionManager
is part of Spring Data and they use Jira for issue tracking. Before you report that issue there, make sure to have a minimal sample that the team can run themselves to reproduce the problem (as a zip attached to the new issue or a link to a GitHub repository).