Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.transaction
Class CMTTransaction

    java.lang.Object
      org.hibernate.transaction.CMTTransaction

All Implemented Interfaces:
  Transaction

    public class CMTTransaction

extends Object
implements Transaction

Implements a basic transaction strategy for CMT transactions. All work is done in the context of the container managed transaction.

Author:
  Gavin King

Field Summary
`protected JDBCContext` | `jdbcContext`
`protected TransactionFactory.Context` | `transactionContext`

Constructor Summary
`CMTTransaction(JDBCContext jdbcContext, TransactionFactory.Context transactionContext)`

Method Summary
`void` | `begin()` Begin a new transaction.
`void` | `commit()` Flush the associated `Session` and end the unit of work (unless we are in `FlushMode.NEVER`.
`Transaction` | `getTransaction()`
`boolean` | `isActive()` Is this transaction still active? Again, this only returns information in relation to the local transaction, not the actual underlying transaction.
`void` | `registerSynchronization(Synchronization sync)` Register a user synchronization callback for this transaction.
`void` | `rollback()` Force the underlying transaction to roll back.
`void` | `setTimeout(int seconds)` Set the transaction timeout for any transaction started by a subsequent call to `begin()` on this instance.
`boolean` | `wasCommitted()` Check if this transaction was successfully committed.
`boolean` | `wasRolledBack()` Was this transaction rolled back or set to rollback only? This only accounts for actions initiated from this local transaction.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### jdbcContext

    protected final JDBCContext jdbcContext

### transactionContext

    protected final TransactionFactory.Context transactionContext

Constructor Detail

### CMTTransaction

    public CMTTransaction(JDBCContext jdbcContext,
                          TransactionFactory.Context transactionContext)

Method Detail

### begin

    public void begin()
               throws HibernateException

  Description copied from interface: `Transaction`
  Begin a new transaction.

  Specified by:
    `begin` in interface `Transaction`
  Throws:
    `HibernateException`

### commit

    public void commit()
                throws HibernateException

  Description copied from interface: `Transaction`
  Flush the associated `Session` and end the unit of work (unless we are in `FlushMode.NEVER`. This method will commit the underlying transaction if and only if the underlying transaction was initiated by this object.

  Specified by:
    `commit` in interface `Transaction`
  Throws:
    `HibernateException`

### rollback

    public void rollback()
                  throws HibernateException

  Description copied from interface: `Transaction`
  Force the underlying transaction to roll back.

  Specified by:
    `rollback` in interface `Transaction`
  Throws:
    `HibernateException`

### getTransaction

    public Transaction getTransaction()
                               throws SystemException

  Throws:
    `SystemException`

### isActive

    public boolean isActive()
                     throws TransactionException

  Description copied from interface: `Transaction`
  Is this transaction still active?

  Again, this only returns information in relation to the local transaction, not the actual underlying transaction.

  Specified by:
    `isActive` in interface `Transaction`
  Returns:
    boolean Treu if this local transaction is still active.
  Throws:
    `TransactionException`

### wasRolledBack

    public boolean wasRolledBack()
                          throws TransactionException

  Description copied from interface: `Transaction`
  Was this transaction rolled back or set to rollback only?

  This only accounts for actions initiated from this local transaction. If, for example, the underlying transaction is forced to rollback via some other means, this method still reports false because the rollback was not initiated from here.

  Specified by:
    `wasRolledBack` in interface `Transaction`
  Returns:
    boolean True if the transaction was rolled back via this local transaction; false otherwise.
  Throws:
    `TransactionException`

### wasCommitted

    public boolean wasCommitted()
                         throws TransactionException

  Description copied from interface: `Transaction`
  Check if this transaction was successfully committed.

  This method could return `false` even after successful invocation of `Transaction.commit()`. As an example, JTA based strategies no-op on `Transaction.commit()` calls if they did not start the transaction; in that case, they also report `Transaction.wasCommitted()` as false.

  Specified by:
    `wasCommitted` in interface `Transaction`
  Returns:
    boolean True if the transaction was (unequivocally) committed via this local transaction; false otherwise.
  Throws:
    `TransactionException`

### registerSynchronization

    public void registerSynchronization(Synchronization sync)
                                 throws HibernateException

  Description copied from interface: `Transaction`
  Register a user synchronization callback for this transaction.

  Specified by:
    `registerSynchronization` in interface `Transaction`
  Parameters:
    `sync` - The Synchronization callback to register.
  Throws:
    `HibernateException`

### setTimeout

    public void setTimeout(int seconds)

  Description copied from interface: `Transaction`
  Set the transaction timeout for any transaction started by a subsequent call to `begin()` on this instance.

  Specified by:
    `setTimeout` in interface `Transaction`
  Parameters:
    `seconds` - The number of seconds before a timeout.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD