Name
UserTransaction
Synopsis
A UserTransaction
is the interface used by client applications to
manage transactions. Typically, a transactional application server
will publish a UserTransaction
through JNDI, and clients will get a
reference to the UserTransaction
using a lookup on the JNDI
Context
. The client can use the UserTransaction
to begin()
a new
transaction in the current thread. If there is already an active
transaction in the current thread and the transaction manager doesn’t
support nested transactions, then a NotSupportedException
is
thrown. The client can either commit()
or rollback()
the current
transaction when it’s complete. The setRollbackOnly()
method is used
to flag the current transaction so that it can only be rolled
back. The setTransactionTimeout()
method is used to set the timeout,
in seconds, of any subsequent transactions started through the
transaction manager.
public interface UserTransaction { // Public Instance Methods public abstract void begin( ) throws javax.transaction.NotSupportedException, javax.transaction.SystemException; public abstract void commit( ) throws RollbackException, HeuristicMixedException, HeuristicRollbackException, java.lang.SecurityException, java.lang.IllegalStateException, javax.transaction.SystemException; public abstract int getStatus( ) throws javax.transaction.SystemException; public abstract void rollback( ) throws java.lang.IllegalStateException, java.lang.SecurityException, javax.transaction.SystemException; public abstract ...
Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.