public class CMTTransaction extends Object implements Transaction
| Modifier and Type | Field and Description |
|---|---|
protected JDBCContext |
jdbcContext |
protected TransactionFactory.Context |
transactionContext |
| Constructor and Description |
|---|
CMTTransaction(JDBCContext jdbcContext,
TransactionFactory.Context transactionContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
begin()
Begin a new transaction.
|
void |
commit()
Flush the associated Session and end the unit of work (unless
we are in
FlushMode.MANUAL. |
Transaction |
getTransaction()
Getter for property 'transaction'.
|
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.
|
protected final JDBCContext jdbcContext
protected final TransactionFactory.Context transactionContext
public CMTTransaction(JDBCContext jdbcContext, TransactionFactory.Context transactionContext)
public void begin()
throws HibernateException
begin in interface TransactionHibernateExceptionpublic void commit()
throws HibernateException
FlushMode.MANUAL.
This method will commit the underlying transaction if and only
if the underlying transaction was initiated by this object.commit in interface TransactionHibernateExceptionpublic void rollback()
throws HibernateException
rollback in interface TransactionHibernateExceptionpublic Transaction getTransaction() throws SystemException
SystemExceptionpublic boolean isActive()
throws TransactionException
isActive in interface TransactionTransactionExceptionpublic boolean wasRolledBack()
throws TransactionException
wasRolledBack in interface TransactionTransactionExceptionpublic boolean wasCommitted()
throws TransactionException
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.wasCommitted in interface TransactionTransactionExceptionpublic void registerSynchronization(Synchronization sync) throws HibernateException
registerSynchronization in interface Transactionsync - The Synchronization callback to register.HibernateExceptionpublic void setTimeout(int seconds)
setTimeout in interface Transactionseconds - The number of seconds before a timeout.Copyright © 2002-2017 Red Hat Middleware, LLC. All Rights Reserved