Java Transaction API

The Java Transaction API ( JTA ) is a specified by Sun and the Java Community Process programming interface (API ) that enables the use of distributed transactions across multiple XA resources in Java.


Transaction management is an important part of business-critical data processing applications. It is inter alia responsible for ensuring that transactions only change the data stored in a database an application permanently, if they can be completed entirely error free.

However, transactions are not only against individual databases necessary, but also to other resources (such as messaging systems). Also necessary are often distributed transactions, which are transactions which ( for example, multiple databases) run over multiple resources simultaneously. Exactly this is achieved by the implementation of JTA. Other criteria such as thread safe ( concurrency ), so for example the avoidance of race conditions do not fall within the remit of JTA.

Operation and applications

JTA itself defines the interface (interfaces and exception classes ), can communicate with transaction managers on Java programs. Transaction manager in turn usually implement the Java Transaction Service ( JTS ) API, which is the standard interface for JTA compatible transaction server. JTS is itself a specification for transaction manager, which ( OTS) implements the JTA specification at the communication level, and the OMG Object Transaction Service specification for the Java mapping.

The JTA is based on the X / Open XA standard, which is published by the Open Group specification for distributed transaction processing, the processing of distributed transactions across multiple systems. This standard provides for the use of a transaction manager for coordinating transactions across multiple resources. The resource itself typically offer their own interfaces for the treatment of transactions (eg, transactions via the JDBC SQL interface for databases ). In addition, however, they must also implement the XA protocol for X / Open XA, only then is called a resource "XA - compliant". By means of the two-phase commit protocol, the X / Open XA standard ensures that a distributed transaction can proceed also via different resources correctly.

The Java Transaction API is a programming interface of the Java Platform, Enterprise Edition, and thus a mandatory part of all Java application server. When using the Java Platform, Standard Edition requires, however, a JTA transaction manager capable be consulted. Examples include Transaction Essentials of Atomikos or the Java Open Transaction Manager ( JOTM ) - see Related links.

Usually is not programmed in the development directly opposite the JTA, but via frameworks like Spring, Hibernate or TopLink. These frameworks can ensure a controlled transaction management across distributed resources, without the developer comes in contact with the complexity of using JTA JTA.


The Java Transaction API developed by Sun and the Java Community Process under the Java Specification Request (JSR ) 907. The first version of the JTA was adopted together with the JTS specification in December 1999. The minimally improved version 1.0.1 was completed on 27 September 2001. The current version is JTA 1.1 from 1 November 2002.