Class TransactionImpl
java.lang.Object
org.hibernate.engine.transaction.internal.TransactionImpl
- All Implemented Interfaces:
EntityTransaction,TransactionImplementor,Transaction
- Author:
- Andrea Boriero, Steve Ebersole
-
Constructor Summary
ConstructorsConstructorDescriptionTransactionImpl(TransactionCoordinator transactionCoordinator, AbstractSharedSessionContract session) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanvoidbegin()Start a resource transaction.voidcommit()Commit the current resource transaction, writing any unflushed changes to the database.booleanDetermine whether the current resource transaction has been marked for rollback.Get the current status of this transaction.intRetrieve the transaction timeout set for this instance.booleanisActive()Indicate whether a resource transaction is in progress.booleanisActive(boolean isMarkedForRollbackConsideredActive) Indicate whether a resource transaction is in progress.voidAttempt to mark the underlying transaction for rollback only.voidregisterSynchronization(Synchronization synchronization) Register a usersynchronization callbackfor this transaction.voidrollback()Roll back the current resource transaction.voidMark the current resource transaction so that the only possible outcome of the transaction is for the transaction to be rolled back.voidsetTimeout(int seconds) Set the transaction timeout for any transaction started by any subsequent call toEntityTransaction.begin()on this instance.
-
Constructor Details
-
Method Details
-
begin
public void begin()Description copied from interface:EntityTransactionStart a resource transaction.- Specified by:
beginin interfaceEntityTransaction
-
commit
public void commit()Description copied from interface:EntityTransactionCommit the current resource transaction, writing any unflushed changes to the database.- Specified by:
commitin interfaceEntityTransaction
-
internalGetTransactionDriverControl
-
rollback
public void rollback()Description copied from interface:EntityTransactionRoll back the current resource transaction.- Specified by:
rollbackin interfaceEntityTransaction
-
isActive
public boolean isActive()Description copied from interface:EntityTransactionIndicate whether a resource transaction is in progress.- Specified by:
isActivein interfaceEntityTransaction- Returns:
- boolean indicating whether transaction is in progress
-
isActive
public boolean isActive(boolean isMarkedForRollbackConsideredActive) Description copied from interface:TransactionImplementorIndicate whether a resource transaction is in progress.- Specified by:
isActivein interfaceTransactionImplementor- Parameters:
isMarkedForRollbackConsideredActive- whether to considerTransactionStatus.MARKED_ROLLBACKas active.- Returns:
- boolean indicating whether transaction is in progress
-
getStatus
Description copied from interface:TransactionGet the current status of this transaction.- Specified by:
getStatusin interfaceTransaction
-
registerSynchronization
Description copied from interface:TransactionRegister a usersynchronization callbackfor this transaction.- Specified by:
registerSynchronizationin interfaceTransaction- Parameters:
synchronization- TheSynchronizationcallback to register.- Throws:
HibernateException- Indicates a problem registering the synchronization.
-
setTimeout
public void setTimeout(int seconds) Description copied from interface:TransactionSet the transaction timeout for any transaction started by any subsequent call toEntityTransaction.begin()on this instance.- Specified by:
setTimeoutin interfaceTransaction- Parameters:
seconds- The number of seconds before a timeout.
-
getTimeout
public int getTimeout()Description copied from interface:TransactionRetrieve the transaction timeout set for this instance. A negative integer indicates that no timeout has been set.- Specified by:
getTimeoutin interfaceTransaction- Returns:
- The timeout, in seconds.
-
markRollbackOnly
public void markRollbackOnly()Description copied from interface:TransactionAttempt to mark the underlying transaction for rollback only.- Specified by:
markRollbackOnlyin interfaceTransaction
-
setRollbackOnly
public void setRollbackOnly()Description copied from interface:EntityTransactionMark the current resource transaction so that the only possible outcome of the transaction is for the transaction to be rolled back.- Specified by:
setRollbackOnlyin interfaceEntityTransaction
-
getRollbackOnly
public boolean getRollbackOnly()Description copied from interface:EntityTransactionDetermine whether the current resource transaction has been marked for rollback.- Specified by:
getRollbackOnlyin interfaceEntityTransaction- Returns:
- boolean indicating whether the transaction has been marked for rollback
-
allowFailedCommitToPhysicallyRollback
protected boolean allowFailedCommitToPhysicallyRollback()
-