public interface Transaction
Session.beginTransaction()
,
TransactionFactory
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 . |
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 synchronization)
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.
|
void begin() throws HibernateException
HibernateException
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.HibernateException
void rollback() throws HibernateException
HibernateException
boolean wasRolledBack() throws HibernateException
HibernateException
boolean wasCommitted() throws HibernateException
commit()
. As an example, JTA based strategies no-op on
commit()
calls if they did not start the transaction; in that case,
they also report wasCommitted()
as false.HibernateException
boolean isActive() throws HibernateException
HibernateException
void registerSynchronization(Synchronization synchronization) throws HibernateException
synchronization
- The Synchronization callback to register.HibernateException
void setTimeout(int seconds)
seconds
- The number of seconds before a timeout.Copyright © 2002-2017 Red Hat Middleware, LLC. All Rights Reserved