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()
boolean
isActive
(boolean isMarkedForRollbackConsideredActive) Indicate whether a resource transaction is in progress.void
Attempt to mark the underlying transaction for rollback only.void
registerSynchronization
(Synchronization synchronization) Register a usersynchronization callback
for this transaction.void
rollback()
void
void
setTimeout
(int seconds) Set the transaction timeout for any transaction started by any subsequent call toEntityTransaction.begin()
on this instance.void
setTimeout
(@Nullable Integer seconds)
-
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()- Specified by:
isActive
in interfaceEntityTransaction
-
isActive
public boolean isActive(boolean isMarkedForRollbackConsideredActive) Description copied from interface:TransactionImplementor
Indicate whether a resource transaction is in progress.- Specified by:
isActive
in interfaceTransactionImplementor
- Parameters:
isMarkedForRollbackConsideredActive
- whether to considerTransactionStatus.MARKED_ROLLBACK
as active.- Returns:
- boolean indicating whether transaction is in progress
-
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 usersynchronization callback
for this transaction.- Specified by:
registerSynchronization
in interfaceTransaction
- Parameters:
synchronization
- TheSynchronization
callback to register.- Throws:
HibernateException
- Indicates a problem registering the synchronization.
-
setTimeout
public void setTimeout(int seconds) Description copied from interface:Transaction
Set the transaction timeout for any transaction started by any subsequent call toEntityTransaction.begin()
on this instance.- 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 negative integer indicates that no timeout has been set.- Specified by:
getTimeout
in interfaceEntityTransaction
- Specified by:
getTimeout
in interfaceTransaction
- Returns:
- The timeout, in seconds.
-
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()
-