0

I am having one application with multiple datasource and i am facing one issue where i am calling both datasource in one transaction and i am getting result from first datasource but when i am trying to get result from second datasource i am getting exception so at that time i want to rollback both the datasource result. so how we can do that using atomikos? or we have any other way to do it? I know one way ChainedTransactionManager but it is deprecated so we can't use it.

Let me know if you have anyways to handle above situation.

My expected result is to find a way to rollback both the datasource result when we get exception in any datasource result.

1 Answers1

0

try PlatformTransactionManager here is the doc https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/PlatformTransactionManager.html .This bloger has the same problem with you https://medium.com/@inzuael/how-to-use-multiple-datasources-with-springboot-exposed-jpa-6bd705bfe994

lamic Zo
  • 31
  • 2
  • Hi @lamic Zo, Above post is related to JPA but i need to implement it with JDBC Template. Do you have any other reference for that? – Dharmin Patel Mar 14 '23 at 09:28
  • I wonder if this would help https://docs.spring.io/spring-framework/docs/3.0.0.M3/reference/html/ch11s06.html;this is about using transaction management in Spring jdbcTemplate; 11.6.2 Using the PlatformTransactionManager is also in the documentation – lamic Zo Mar 15 '23 at 05:47
  • Hi @Lamic Zo,above page is not found. – Dharmin Patel Mar 15 '23 at 05:59
  • try this one https://docs.spring.io/spring-framework/docs/3.0.0.M3/reference/html/ch11s06.html – lamic Zo Mar 15 '23 at 06:02