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 boolean
void
begin()
void
commit()
boolean
Get the current status of this transaction.@Nullable Integer
Retrieve the transaction timeout set for this instance.boolean
isActive()
Is this transaction still active?void
Attempt to mark the underlying transaction for rollback only.void
registerSynchronization
(Synchronization synchronization) Register a synchronization callback for this transaction.void
rollback()
void
void
setTimeout
(int seconds) Set the transaction timeout for any transaction started by a subsequent call toEntityTransaction.begin()
on this instance ofTransaction
.void
setTimeout
(@Nullable Integer seconds) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.hibernate.Transaction
isComplete, isInCompletionProcess, runAfterCompletion, runBeforeCompletion, wasFailure, wasStarted, wasSuccessful
-
Constructor Details
-
Method Details
-
begin
public void begin()- Specified by:
begin
in interfaceEntityTransaction
-
commit
public void commit()- Specified by:
commit
in interfaceEntityTransaction
-
internalGetTransactionDriverControl
-
rollback
public void rollback()- Specified by:
rollback
in interfaceEntityTransaction
-
isActive
public boolean isActive()Description copied from interface:Transaction
Is 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:
isActive
in interfaceEntityTransaction
- Specified by:
isActive
in interfaceTransaction
- Returns:
true
if the status isTransactionStatus.ACTIVE
orTransactionStatus.MARKED_ROLLBACK
-
getStatus
Description copied from interface:Transaction
Get the current status of this transaction.- Specified by:
getStatus
in interfaceTransaction
-
registerSynchronization
Description copied from interface:Transaction
Register a synchronization callback for this transaction.- Specified by:
registerSynchronization
in interfaceTransaction
- Parameters:
synchronization
- TheSynchronization
callback to register- Throws:
HibernateException
-
setTimeout
public void setTimeout(int seconds) Description copied from interface:Transaction
Set the transaction timeout for any transaction started by a subsequent call toEntityTransaction.begin()
on this instance ofTransaction
.- Specified by:
setTimeout
in interfaceTransaction
- Parameters:
seconds
- The number of seconds before a timeout
-
setTimeout
- Specified by:
setTimeout
in interfaceEntityTransaction
-
getTimeout
Description copied from interface:Transaction
Retrieve the transaction timeout set for this instance.A
null
return value indicates that no timeout has been set.- Specified by:
getTimeout
in interfaceEntityTransaction
- Specified by:
getTimeout
in interfaceTransaction
- Returns:
- the timeout, in seconds, or
null
-
markRollbackOnly
public void markRollbackOnly()Description copied from interface:Transaction
Attempt 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:
markRollbackOnly
in interfaceTransaction
- See Also:
-
setRollbackOnly
public void setRollbackOnly()- Specified by:
setRollbackOnly
in interfaceEntityTransaction
-
getRollbackOnly
public boolean getRollbackOnly()- Specified by:
getRollbackOnly
in interfaceEntityTransaction
-
allowFailedCommitToPhysicallyRollback
protected boolean allowFailedCommitToPhysicallyRollback()
-