Top Description Methods
org.hibernate.engine.transaction.jta.platform.spi

public Interface JtaPlatform

extends Service
Known Direct Implementers
org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform, org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform
Imports
jakarta.transaction.Synchronization, .SystemException, .Transaction, .TransactionManager, .UserTransaction, org.checkerframework.checker.nullness.qual.Nullable, org.hibernate.service.Service

A Service that defines how Hibernate interacts with JTA on a certain platform. In particular, a JtaPlatform allows Hibernate to obtain the TransactionManager and UserTransaction, and register Synchronizations.

An implementation may be selected by specifying the configuration property hibernate.transaction.jta.platform. Alternatively, a JtaPlatformProvider or even a custom JtaPlatformResolver may be used.

Author
Steve Ebersole
See Also
JtaPlatformResolver, JtaPlatformProvider

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

True if registering a Synchronization is currently allowed; false otherwise.
canRegisterSynchronization
()

Can we currently register a Synchronization?

public int

Returns:

The current status.
getCurrentStatus
()

Obtain the current transaction status using whatever means is preferred for this platform

public @Nullable Object

Returns:

An appropriate identifier
getTransactionIdentifier
(Transaction
The transaction to be identified.
transaction
)

Determine an identifier for the given transaction appropriate for use in caching/lookup usages.

public void
registerSynchronization(Synchronization
The synchronization to register
synchronization
)

Register a JTA Synchronization in the means defined by the platform.

public @Nullable TransactionManager
public @Nullable UserTransaction

Method Detail

canRegisterSynchronizationback to summary
public boolean canRegisterSynchronization()

Can we currently register a Synchronization?

Returns:boolean

True if registering a Synchronization is currently allowed; false otherwise.

getCurrentStatusback to summary
public int getCurrentStatus() throws SystemException

Obtain the current transaction status using whatever means is preferred for this platform

Returns:int

The current status.

Exceptions
SystemException:
Indicates a problem access the underlying status
getTransactionIdentifierback to summary
public @Nullable Object getTransactionIdentifier(Transaction transaction)

Determine an identifier for the given transaction appropriate for use in caching/lookup usages.

Generally speaking the transaction itself will be returned here. This method was added specifically for use in WebSphere and other unfriendly Java EE containers.

Parameters
transaction:Transaction

The transaction to be identified.

Returns:@Nullable Object

An appropriate identifier

registerSynchronizationback to summary
public void registerSynchronization(Synchronization synchronization)

Register a JTA Synchronization in the means defined by the platform.

Parameters
synchronization:Synchronization

The synchronization to register

retrieveTransactionManagerback to summary
public @Nullable TransactionManager retrieveTransactionManager()

Locate the TransactionManager.

Returns:@Nullable TransactionManager

The TransactionManager

retrieveUserTransactionback to summary
public @Nullable UserTransaction retrieveUserTransaction()

Locate the UserTransaction.

If org.hibernate.cfg.AvailableSettings#PREFER_USER_TRANSACTION is enabled, Hibernate will use the UserTransaction in preference to the TransactionManager where possible.

Returns:@Nullable UserTransaction

The UserTransaction