Spring Framework

org.springframework.orm.hibernate3
Class SpringTransactionFactory

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

public class SpringTransactionFactory
extends java.lang.Object
implements org.hibernate.transaction.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
org.hibernate.transaction.TransactionFactory.Context
 
Constructor Summary
SpringTransactionFactory()
           
 
Method Summary
 boolean areCallbacksLocalToHibernateTransactions()
           
 void configure(java.util.Properties props)
           
 org.hibernate.Transaction createTransaction(org.hibernate.jdbc.JDBCContext jdbcContext, org.hibernate.transaction.TransactionFactory.Context transactionContext)
           
 org.hibernate.ConnectionReleaseMode getDefaultReleaseMode()
          Sets connection release mode "on_close" as default.
 boolean isTransactionInProgress(org.hibernate.jdbc.JDBCContext jdbcContext, org.hibernate.transaction.TransactionFactory.Context transactionContext, org.hibernate.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 org.hibernate.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 org.hibernate.transaction.TransactionFactory

createTransaction

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

configure

public void configure(java.util.Properties props)
Specified by:
configure in interface org.hibernate.transaction.TransactionFactory

isTransactionManagerRequired

public boolean isTransactionManagerRequired()
Specified by:
isTransactionManagerRequired in interface org.hibernate.transaction.TransactionFactory

areCallbacksLocalToHibernateTransactions

public boolean areCallbacksLocalToHibernateTransactions()
Specified by:
areCallbacksLocalToHibernateTransactions in interface org.hibernate.transaction.TransactionFactory

isTransactionInProgress

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

Spring Framework