I'm implementing a Spring application accessing two SQL databases. There's a requirement of having distributed transaction embracing both connections.
Most of the tutorials on how to setup Atomikos with Spring include the following line in the AtomikosDataSourceBean
configuration:
atomikosDataSource.setLocalTransactionMode(true);
However the Javadoc says:
/**
* Sets localTransactionMode. Optional, defaults to true.
*
* @param localTransactionMode If true, then (for historical reasons) this
* datasource supports "hybrid" behaviour: if a JTA transaction is present then
* XA will be used, if not then a regular JDBC connection with connection-level
* commit/rollback will be returned.
*
* For safety, this property is best left to false: that way, there is no
* doubt about the transactional nature of your JDBC work.
*/
public void setLocalTransactionMode(boolean localTransactionMode) {
this.localTransactionMode = localTransactionMode;
}
Does it mean that if I set localTransactionMode
to true
, I would no longer have a truly distributed transaction but rather a poor substitute that works more like the org.springframework.data.transaction.ChainedTransactionManager
?