Class TransactionImpl
java.lang.Object
org.hibernate.engine.transaction.internal.TransactionImpl
- All Implemented Interfaces:
EntityTransaction,TransactionImplementor,Transaction
-
Constructor Summary
ConstructorsConstructorDescriptionTransactionImpl(TransactionCoordinator transactionCoordinator, AbstractSharedSessionContract session) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanvoidbegin()voidcommit()booleanGet the current status of this transaction.@Nullable IntegerRetrieve the transaction timeout set for this instance.booleanisActive()Is this transaction still active?voidAttempt to mark the underlying transaction for rollback only.voidregisterSynchronization(Synchronization synchronization) Register a synchronization callback for this transaction.voidrollback()voidvoidsetTimeout(int seconds) Set the transaction timeout for any transaction started by a subsequent call toEntityTransaction.begin()on this instance ofTransaction.voidsetTimeout(@Nullable Integer seconds) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.Transaction
isComplete, isInCompletionProcess, runAfterCompletion, runBeforeCompletion, wasFailure, wasStarted, wasSuccessful
-
Constructor Details
-
Method Details
-
begin
public void begin()- Specified by:
beginin interfaceEntityTransaction
-
commit
public void commit()- Specified by:
commitin interfaceEntityTransaction
-
internalGetTransactionDriverControl
-
rollback
public void rollback()- Specified by:
rollbackin interfaceEntityTransaction
-
isActive
public boolean isActive()Description copied from interface:TransactionIs this transaction still active?A transaction which has been marked for rollback is still considered active, and is still able to perform work. To determine if a transaction has been marked for rollback, call
EntityTransaction.getRollbackOnly().- Specified by:
isActivein interfaceEntityTransaction- Specified by:
isActivein interfaceTransaction- Returns:
trueif the status isTransactionStatus.ACTIVEorTransactionStatus.MARKED_ROLLBACK
-
getStatus
Description copied from interface:TransactionGet the current status of this transaction.- Specified by:
getStatusin interfaceTransaction
-
registerSynchronization
Description copied from interface:TransactionRegister a synchronization callback for this transaction.- Specified by:
registerSynchronizationin interfaceTransaction- Parameters:
synchronization- TheSynchronizationcallback to register- Throws:
HibernateException
-
setTimeout
public void setTimeout(int seconds) Description copied from interface:TransactionSet the transaction timeout for any transaction started by a subsequent call toEntityTransaction.begin()on this instance ofTransaction.- Specified by:
setTimeoutin interfaceTransaction- Parameters:
seconds- The number of seconds before a timeout
-
setTimeout
- Specified by:
setTimeoutin interfaceEntityTransaction
-
getTimeout
Description copied from interface:TransactionRetrieve the transaction timeout set for this instance.A
nullreturn value indicates that no timeout has been set.- Specified by:
getTimeoutin interfaceEntityTransaction- Specified by:
getTimeoutin interfaceTransaction- Returns:
- the timeout, in seconds, or
null
-
markRollbackOnly
public void markRollbackOnly()Description copied from interface:TransactionAttempt to mark the underlying transaction for rollback only.Unlike
EntityTransaction.setRollbackOnly(), which is specified by JPA to throw when the transaction is inactive, this operation may be called on an inactive transaction, in which case it has no effect.- Specified by:
markRollbackOnlyin interfaceTransaction- See Also:
-
setRollbackOnly
public void setRollbackOnly()- Specified by:
setRollbackOnlyin interfaceEntityTransaction
-
getRollbackOnly
public boolean getRollbackOnly()- Specified by:
getRollbackOnlyin interfaceEntityTransaction
-
allowFailedCommitToPhysicallyRollback
protected boolean allowFailedCommitToPhysicallyRollback()
-