Package org.hibernate.resource.transaction
Defines the resource-level transaction capabilities of Hibernate, centered
around the
TransactionCoordinator
contract.
An instance of TransactionCoordinator
may be constructed using a
TransactionCoordinatorBuilder
,
which is a Service
and available via the
StandardServiceRegistry
.
Resource-local transaction
A resource-local transaction is exposed to the application as an instance ofTransaction
, allowing full control over the
transaction lifecycle. That control flows from the Transaction
into
the TransactionCoordinator
via its exposed
TransactionCoordinator.TransactionDriver
.
Physical transaction
It is the underlying physical transaction which ultimately controls the database transaction. This might be:- a JTA transaction, represented by a
Transaction
orUserTransaction
, or - a "JDBC transaction", as expressed via the JDBC
Connection
.
The corresponding concrete implementations of TransactionCoordinator
manage the necessary bridging.
Local Synchronization
The Hibernate transaction API allows the application itself to register JTASynchronization
objects with the
TransactionCoordinator
. These local Synchronization
s work in
all transaction environments.
See Transaction.registerSynchronization(jakarta.transaction.Synchronization)
and
SynchronizationRegistry
for
additional details.
-
Exception Summary Exception Description LocalSynchronizationException Wraps an exception thrown from a "local synchronization" (one registered in the SynchronizationRegistry).NullSynchronizationException Indicates an attempt to register a null synchronization.TransactionRequiredForJoinException Indicates a call toTransactionCoordinator.explicitJoin()
that requires an active transaction where there currently is none.