Transaction is a complete unit of work that completes succesfully or results with unaltered state.
Java Transaction types:
Java Transaction Service(JTS) :
- specifies the implementation of a Java transaction manager.
Java Transaction API(JTA) :
- calls the lower-level JTS methods.
- high level, implementation independent, protocol independent API.
- offered by J2EE technology.
- provides reliable environment for the J2EE container.
- enables applications to perform distributed transactions.
- specifies standard Java interfaces between a transaction manager and other components involved in a distributed transaction system.
- transaction manager, application, application server, and resource manager take roles in.
Transaction and Resource Managers :
- Transaction manager decides whether to commit or rollback at the end of the transaction in a distributed system and coordinates various resource managers.
- Resource manager is responsible from the controlling of accessing the common resources in the distributed system.
JTA vs JDBC :
- JDBC driver has to support both normal JDBC interactions and XAResource part of JTA.
- XA protocol enables resource manager to take place in the transaction.
- JDBC is responsible for "translating" between resource manager and transaction manager.
- Application server, JDBC driver and transaction manager care about the distributed transaction management.
- Application developer should not enter the scope of the transaction.
You might also like Following posts