Interface JtaPlatform
- All Superinterfaces:
Serializable,Service
- All Known Implementing Classes:
AbstractJtaPlatform,AtomikosJtaPlatform,GlassFishJtaPlatform,JBossAppServerJtaPlatform,JBossStandAloneJtaPlatform,NoJtaPlatform,ResinJtaPlatform,WeblogicJtaPlatform,WebSphereLibertyJtaPlatform,WildFlyStandAloneJtaPlatform
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.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanCan we currently register aSynchronization?intObtain the current transaction status using whatever means is preferred for this platform@Nullable ObjectgetTransactionIdentifier(Transaction transaction) Determine an identifier for the given transaction appropriate for use in caching/lookup usages.voidregisterSynchronization(Synchronization synchronization) Register a JTASynchronizationin the means defined by the platform.@Nullable TransactionManagerLocate theTransactionManager.@Nullable UserTransactionLocate theUserTransaction.
-
Method Details
-
retrieveTransactionManager
@Nullable TransactionManager retrieveTransactionManager()Locate theTransactionManager.- Returns:
- The
TransactionManager
-
retrieveUserTransaction
@Nullable UserTransaction retrieveUserTransaction()Locate theUserTransaction.If
TransactionSettings.PREFER_USER_TRANSACTIONis enabled, Hibernate will use theUserTransactionin preference to theTransactionManagerwhere possible.- Returns:
- The
UserTransaction
-
getTransactionIdentifier
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- The transaction to be identified.- Returns:
- An appropriate identifier
-
canRegisterSynchronization
boolean canRegisterSynchronization()Can we currently register aSynchronization?- Returns:
- True if registering a
Synchronizationis currently allowed; false otherwise.
-
registerSynchronization
Register a JTASynchronizationin the means defined by the platform.- Parameters:
synchronization- The synchronization to register
-
getCurrentStatus
Obtain the current transaction status using whatever means is preferred for this platform- Returns:
- The current status.
- Throws:
SystemException- Indicates a problem access the underlying status
-