org.springframework.orm.hibernate3
Class SpringTransactionFactory

java.lang.Object
  extended by org.springframework.orm.hibernate3.SpringTransactionFactory
All Implemented Interfaces:
TransactionFactory

public class SpringTransactionFactory
extends Object
implements TransactionFactory

Spring-aware implementation of the Hibernate TransactionFactory interface, aware of Spring-synchronized transactions (in particular Spring-managed JTA transactions) and asking for default release mode ON_CLOSE. Otherwise identical to Hibernate's default JDBCTransactionFactory implementation.

Since:
2.5.4
Author:
Juergen Hoeller
See Also:
TransactionSynchronizationManager, JDBCTransactionFactory

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.hibernate.transaction.TransactionFactory
TransactionFactory.Context
 
Constructor Summary
SpringTransactionFactory()
           
 
Method Summary
 boolean areCallbacksLocalToHibernateTransactions()
           
 void configure(Properties props)
           
 Transaction createTransaction(JDBCContext jdbcContext, TransactionFactory.Context transactionContext)
           
 ConnectionReleaseMode getDefaultReleaseMode()
          Sets connection release mode "on_close" as default.
 boolean isTransactionInProgress(JDBCContext jdbcContext, TransactionFactory.Context transactionContext, Transaction transaction)
           
 boolean isTransactionManagerRequired()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringTransactionFactory

public SpringTransactionFactory()
Method Detail

getDefaultReleaseMode

public ConnectionReleaseMode getDefaultReleaseMode()
Sets connection release mode "on_close" as default.

This was the case for Hibernate 3.0; Hibernate 3.1 changed it to "auto" (i.e. "after_statement" or "after_transaction"). However, for Spring's resource management (in particular for HibernateTransactionManager), "on_close" is the better default.

Specified by:
getDefaultReleaseMode in interface TransactionFactory

createTransaction

public Transaction createTransaction(JDBCContext jdbcContext,
                                     TransactionFactory.Context transactionContext)
Specified by:
createTransaction in interface TransactionFactory

configure

public void configure(Properties props)
Specified by:
configure in interface TransactionFactory

isTransactionManagerRequired

public boolean isTransactionManagerRequired()
Specified by:
isTransactionManagerRequired in interface TransactionFactory

areCallbacksLocalToHibernateTransactions

public boolean areCallbacksLocalToHibernateTransactions()
Specified by:
areCallbacksLocalToHibernateTransactions in interface TransactionFactory

isTransactionInProgress

public boolean isTransactionInProgress(JDBCContext jdbcContext,
                                       TransactionFactory.Context transactionContext,
                                       Transaction transaction)
Specified by:
isTransactionInProgress in interface TransactionFactory