Interface JtaPlatform

All Superinterfaces:
Serializable, Service
All Known Implementing Classes:
AbstractJtaPlatform, AtomikosJtaPlatform, BitronixJtaPlatform, BorlandEnterpriseServerJtaPlatform, JBossAppServerJtaPlatform, JBossStandAloneJtaPlatform, JOnASJtaPlatform, JOTMJtaPlatform, JRun4JtaPlatform, NoJtaPlatform, OC4JJtaPlatform, OrionJtaPlatform, ResinJtaPlatform, SapNetWeaverJtaPlatform, SunOneJtaPlatform, TestingJtaPlatformImpl, WeblogicJtaPlatform, WebSphereExtendedJtaPlatform, WebSphereJtaPlatform, WebSphereLibertyJtaPlatform, WildFlyStandAloneJtaPlatform

public interface JtaPlatform extends 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.

See Also:
  • Method Details

    • retrieveTransactionManager

      @Nullable TransactionManager retrieveTransactionManager()
      Locate the TransactionManager.
      Returns:
      The TransactionManager
    • retrieveUserTransaction

      @Nullable UserTransaction retrieveUserTransaction()
      Locate the UserTransaction.

      If TransactionSettings.PREFER_USER_TRANSACTION is enabled, Hibernate will use the UserTransaction in preference to the TransactionManager where possible.

      Returns:
      The UserTransaction
    • getTransactionIdentifier

      @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 - The transaction to be identified.
      Returns:
      An appropriate identifier
    • canRegisterSynchronization

      boolean canRegisterSynchronization()
      Can we currently register a Synchronization?
      Returns:
      True if registering a Synchronization is currently allowed; false otherwise.
    • registerSynchronization

      void registerSynchronization(Synchronization synchronization)
      Register a JTA Synchronization in the means defined by the platform.
      Parameters:
      synchronization - The synchronization to register
    • getCurrentStatus

      int getCurrentStatus() throws SystemException
      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