type=page
status=published
title=Transactions in Java EE Applications
next=transactions003.html
prev=transactions001.html
~~~~~~
Transactions in Java EE Applications
====================================

[[GIJRG]]

[[transactions-in-java-ee-applications]]
Transactions in Java EE Applications
------------------------------------

In a Java EE application, a transaction is a series of actions that must
all complete successfully, or else all the changes in each action are
backed out. Transactions end in either a commit or a rollback.

The Java Transaction API (JTA) allows applications to access
transactions in a manner that is independent of specific
implementations. JTA specifies standard Java interfaces between a
transaction manager and the parties involved in a distributed
transaction system: the transactional application, the Java EE server,
and the manager that controls access to the shared resources affected by
the transactions.

The JTA defines the `UserTransaction` interface that applications use to
start, commit, or roll back transactions. Application components get a
`UserTransaction` object through a JNDI lookup by using the name
`java:comp/UserTransaction` or by requesting injection of a
`UserTransaction` object. An application server uses a number of
JTA-defined interfaces to communicate with a transaction manager; a
transaction manager uses JTA-defined interfaces to interact with a
resource manager.

The JTA 1.2 specification is available at
`http://jcp.org/en/jsr/detail?id=907`.


