## org.hibernate.transaction
Interface TransactionFactory

All Known Implementing Classes:
  CMTTransactionFactory, JDBCTransactionFactory, JoinableCMTTransactionFactory, JTATransactionFactory

    public interface TransactionFactory

Contract for generating Hibernate `Transaction` instances.

The concrete implementation to be used is specified by the `Environment.TRANSACTION_STRATEGY` configuration setting.

Implementors must be threadsafe and should declare a public default constructor.

Author:
  Anton van Straaten, Gavin King
See Also:
  `Transaction`

Nested Class Summary
`static interface` `TransactionFactory.Context` Callback mechanism; a context is always a `Session` in the Hibernate usage.

Method Summary
`boolean` `areCallbacksLocalToHibernateTransactions()` Are all transaction callbacks local to Hibernate Transactions? Or can the callbacks originate from some other source (e.g.
`void` `configure(Properties props)` Configure from the given properties.
`Transaction` `createTransaction(JDBCContext jdbcContext, TransactionFactory.Context context)` Begin a transaction and return the associated `Transaction` instance.
`ConnectionReleaseMode` `getDefaultReleaseMode()` Get the default connection release mode.
`boolean` `isTransactionInProgress(JDBCContext jdbcContext, TransactionFactory.Context transactionContext, Transaction transaction)` Determine whether an underlying transaction is in progress.
`boolean` `isTransactionManagerRequired()` Do we require access to the JTA TransactionManager for this strategy?

Method Detail

### createTransaction

    Transaction createTransaction(JDBCContext jdbcContext,
                                  TransactionFactory.Context context)
                                  throws HibernateException

  Begin a transaction and return the associated `Transaction` instance.

  Parameters:
    `jdbcContext` - The jdbc context to which the transaction belongs
    `context` - The contract regarding the context in which this transaction will operate.
  Returns:
    Transaction
  Throws:
    `HibernateException` - Indicates a problem generating a transaction instance

### configure

    void configure(Properties props)
                   throws HibernateException

  Configure from the given properties.

  Parameters:
    `props` - The configuration properties.
  Throws:
    `HibernateException` - Indicates a problem configuring this factory.

### getDefaultReleaseMode

    ConnectionReleaseMode getDefaultReleaseMode()

  Get the default connection release mode.

  Returns:
    The default release mode associated with this strategy

### isTransactionManagerRequired

    boolean isTransactionManagerRequired()

  Do we require access to the JTA TransactionManager for this strategy?

  Returns:
    True if this strategy requires access to the JTA TransactionManager; false otherwise.

### areCallbacksLocalToHibernateTransactions

    boolean areCallbacksLocalToHibernateTransactions()

  Are all transaction callbacks local to Hibernate Transactions? Or can the callbacks originate from some other source (e.g. a JTA Synchronization).

  Returns:
    true if callbacks only ever originate from the Hibernate `Transaction`; false otherwise.

### isTransactionInProgress

    boolean isTransactionInProgress(JDBCContext jdbcContext,
                                    TransactionFactory.Context transactionContext,
                                    Transaction transaction)

  Determine whether an underlying transaction is in progress.

  Mainly this is used in determining whether to register a synchronization as well as whether or not to circumvent auto flushing outside transactions.

  Parameters:
    `jdbcContext` - The JDBC context
    `transactionContext` - The transaction context
    `transaction` - The Hibernate transaction
  Returns:
    true if an underlying transaction is know to be in effect.

Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.