|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hibernate.transaction.CMTTransaction
public class CMTTransaction
Implements a basic transaction strategy for CMT transactions. All work is done in the context of the container managed transaction.
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 |
---|
protected final JDBCContext jdbcContext
protected final TransactionFactory.Context transactionContext
Constructor Detail |
---|
public CMTTransaction(JDBCContext jdbcContext, TransactionFactory.Context transactionContext)
Method Detail |
---|
public void begin() throws HibernateException
Transaction
begin
in interface Transaction
HibernateException
public void commit() throws HibernateException
Transaction
FlushMode.NEVER
.
This method will commit the underlying transaction if and only
if the underlying transaction was initiated by this object.
commit
in interface Transaction
HibernateException
public void rollback() throws HibernateException
Transaction
rollback
in interface Transaction
HibernateException
public Transaction getTransaction() throws SystemException
SystemException
public boolean isActive() throws TransactionException
Transaction
isActive
in interface Transaction
TransactionException
public boolean wasRolledBack() throws TransactionException
Transaction
wasRolledBack
in interface Transaction
TransactionException
public boolean wasCommitted() throws TransactionException
Transaction
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 Transaction
TransactionException
public void registerSynchronization(Synchronization sync) throws HibernateException
Transaction
registerSynchronization
in interface Transaction
sync
- The Synchronization callback to register.
HibernateException
public void setTimeout(int seconds)
Transaction
setTimeout
in interface Transaction
seconds
- The number of seconds before a timeout.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |