sf logo

sf.qof.session
Interface UserTransaction

All Known Implementing Classes:
SessionContextFactory.DefaultUserTransaction

public interface UserTransaction

Defines the methods that allow an application to explicitly manage transaction boundaries.

A UserTransaction can be retrieved from the session that is associated to the current thread from the session context:

 UserTransaction trx = SessionContextFactory.getContext().getUserTransaction();
 

See Also:
SessionContext.getUserTransaction(), SessionContextFactory

Method Summary
 void begin()
          Create a new transaction and associate it with the current thread.
 void commit()
          Complete the transaction associated with the current thread.
 boolean isRollbackOnly()
          Returns true if the only possible outcome of the transaction that is associated with the current thread is to roll back the transaction.
 void rollback()
          Roll back the transaction associated with the current thread.
 void setRollbackOnly()
          Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
 

Method Detail

begin

void begin()
           throws SystemException
Create a new transaction and associate it with the current thread.

Throws:
SystemException - Thrown if the transaction manager encounters an unexpected error condition.
IllegalStateException - Thrown if the transaction is already started

commit

void commit()
            throws SystemException,
                   RollbackException
Complete the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction.

Throws:
SystemException - Thrown if the transaction manager encounters an unexpected error condition.
RollbackException - Thrown to indicate that the transaction has been rolled back rather than committed.
IllegalStateException - Thrown if there the transaction was not started

rollback

void rollback()
              throws SystemException
Roll back the transaction associated with the current thread. When this method completes, the thread is no longer associated with a transaction.

Throws:
SystemException - Thrown if the transaction manager encounters an unexpected error condition.
IllegalStateException - Thrown if there the transaction was not started

setRollbackOnly

void setRollbackOnly()
                     throws SystemException
Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.

Throws:
SystemException - Thrown if the transaction manager encounters an unexpected error condition.
IllegalStateException - Thrown if there the transaction was not started

isRollbackOnly

boolean isRollbackOnly()
Returns true if the only possible outcome of the transaction that is associated with the current thread is to roll back the transaction.

Returns:
true if current transaction can only be rolled back
Throws:
IllegalStateException - Thrown if there the transaction was not started

sf logo

Copyright © 2007 brunella ltd. All Rights Reserved.