SimpleTransactionFactory (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.transaction.jta

## Class SimpleTransactionFactory

- java.lang.Object
- - org.springframework.transaction.jta.SimpleTransactionFactory

- All Implemented Interfaces:
    TransactionFactory

      public class SimpleTransactionFactory
      extends Object
      implements TransactionFactory

  Default implementation of the `TransactionFactory` strategy interface, simply wrapping a standard JTA `TransactionManager`.

  Does not support transaction names; simply ignores any specified name.

  Since:
    2.5
  Author:
    Juergen Hoeller
  See Also:
    `TransactionManager.setTransactionTimeout(int)`, `TransactionManager.begin()`, `TransactionManager.getTransaction()`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleTransactionFactory(TransactionManager transactionManager)` Create a new SimpleTransactionFactory for the given TransactionManager

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Transaction` | `createTransaction(String name, int timeout)` Create an active Transaction object based on the given name and timeout.
    `boolean` | `supportsResourceAdapterManagedTransactions()` Determine whether the underlying transaction manager supports XA transactions managed by a resource adapter (i.e.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleTransactionFactory

          public SimpleTransactionFactory(TransactionManager transactionManager)

      Create a new SimpleTransactionFactory for the given TransactionManager
      Parameters:
        `transactionManager` - the JTA TransactionManager to wrap

  - ### Method Detail

    - #### createTransaction

          public Transaction createTransaction(String name,
                                      int timeout)
                                        throws NotSupportedException,
                                               SystemException

      Description copied from interface: `TransactionFactory`
      Create an active Transaction object based on the given name and timeout.
      Specified by:
        `createTransaction` in interface `TransactionFactory`
      Parameters:
        `name` - the transaction name (may be `null`)
        `timeout` - the transaction timeout (may be -1 for the default timeout)
      Returns:
        the active Transaction object (never `null`)
      Throws:
        `NotSupportedException` - if the transaction manager does not support a transaction of the specified type
        `SystemException` - if the transaction manager failed to create the transaction

    - #### supportsResourceAdapterManagedTransactions

          public boolean supportsResourceAdapterManagedTransactions()

      Description copied from interface: `TransactionFactory`
      Determine whether the underlying transaction manager supports XA transactions managed by a resource adapter (i.e. without explicit XA resource enlistment).

      Typically `false`. Checked by `AbstractMessageEndpointFactory` in order to differentiate between invalid configuration and valid ResourceAdapter-managed transactions.

      Specified by:
        `supportsResourceAdapterManagedTransactions` in interface `TransactionFactory`
      See Also:
        `ResourceAdapter.endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory, javax.resource.spi.ActivationSpec)`, `MessageEndpointFactory.isDeliveryTransacted(java.lang.reflect.Method)`