2

By using an external jta manager like atomikos or bitronix, is it possible to combine a spring transaction and a non-spring transaction? If possible, do I still need to annotate the method as transactional - what if the transactions span across methods or classes?

l a s
  • 3,836
  • 10
  • 42
  • 61
  • What do you mean about combining `a spring transaction and a non-spring transaction`? What is a `non-spring transaction`? – Vlad Mihalcea Jul 21 '17 at 05:40
  • I have an application that involves transactions using spring and jta. I've another library that accepts entity manager factory (non-spring) and performs transactions using a different data source. Just by using jta based transaction manager - is it possible to achieve roll back etc if either one of the side fails? – l a s Jul 21 '17 at 05:45

1 Answers1

0

Then you should allow the other library use the same JTA library which you configured in Spring with either Bitronix or Atomikos.

This way, you have a a JTA transcation manager configured in Spring and a single JTA DataSource which you need to pass to the outer library via the hibernate.connection.datasource configuration property.

Vlad Mihalcea
  • 142,745
  • 71
  • 566
  • 911