In the latest releases, I've noticed that the number of JTA providers officially supported in Spring Boot has been remarkably reduced.
When I started using Spring boot about three years ago, there were three 'starters' providing JTA support: Narayana, Bitronix and Atomikos.
Now Narayana isn't mentioned anymore in the official latest documentation, while Bitronix is marked as deprecated.
This obviously imply that the only choice left is using Atomikos.
I wonder if the next step will be dropping JTA support at all.
I'm about to start a long-term project where I'll need to handle distributed transactions to work with two or more entitymanagers, and I'm doubt if using JTA would be a good choice, or if I'd better start
planning some other strategy to work with more than a single entitymanager - eventual consistency tipical of microservices ?
Yes. JTA is useful when we need to deal with multiple databases.
In one single transaction, two rows of data may be saved to two different DB's.
But when one save process throws an exception, both save processes should be rolled back.
JTA is the right approach to handle this situation.
The counterpart of JTA is JPA transaction.
JPA is to deal with a transaction within one DB.
If you use JPA transaction to handle save in two DB's, what will happen?
One set of data is saved. The other set of data is not saved when an exception is thrown.
The transaction is not rolled back.
With most applications moving to the cloud, the focus is on designing them as a set of microservices.
Managing those microservices and the communication/dependecies between is therefore taken care of by the cloud provider.
So yeah, I guess the cloud removes the need for managing distributed transaction from the code and that is why JTA is slowly dying.