What's the difference between nonXADatasource with jta="true" and XADataSource?

user3663882 picture user3663882 · Jan 5, 2015 · Viewed 28.8k times · Source

I was confused by the fact that we can allow to use JTA transactions with a non-XA-datasource. Link to the documentation. So what is the difference between XA/non-XA datasources? Why should we use XA-datasources at all?

Answer

ashokhein picture ashokhein · Jan 6, 2015

An XA transaction, in the most general terms, is a "global transaction" that may span multiple resources. A non-XA transaction always involves just one resource.

An XA transaction involves a coordinating transaction manager, with one or more databases (or other resources, like JMS) all involved in a single global transaction. Non-XA transactions have no transaction coordinator, and a single resource is doing all its transaction work itself (this is sometimes called local transactions).

Note: The explanation above was taken from: theserverside (Mike Spille)

jta="true", Transaction commit automatically.