org.springframework.orm.hibernate
Class LocalTransactionManagerLookup
java.lang.Object
org.springframework.orm.hibernate.LocalTransactionManagerLookup
- All Implemented Interfaces:
- net.sf.hibernate.transaction.TransactionManagerLookup
- public class LocalTransactionManagerLookup
- extends java.lang.Object
- implements net.sf.hibernate.transaction.TransactionManagerLookup
Implementation of Hibernate's TransactionManagerLookup interface that
returns a Spring-managed JTA TransactionManager, determined by
LocalSessionFactoryBean's "transactionManager" property.
The main advantage of this TransactionManagerLookup is that it avoids
double configuration of JTA specifics. A single TransactionManager bean can
be used for both JtaTransactionManager and LocalSessionFactoryBean, with no
JTA setup in Hibernate configuration.
Alternatively, use Hibernate's own TransactionManagerLookup implementations:
Spring's JtaTransactionManager only requires a TransactionManager for suspending
and resuming transactions, so you might not need to apply such special Spring
configuration at all.
- Since:
- 21.01.2004
- Author:
- Juergen Hoeller
- See Also:
LocalSessionFactoryBean.setJtaTransactionManager(javax.transaction.TransactionManager)
,
JtaTransactionManager.setTransactionManager(javax.transaction.TransactionManager)
Field Summary |
protected static java.lang.ThreadLocal |
configTimeTransactionManagerHolder
This will hold the TransactionManager to use for the currently configured
Hibernate SessionFactory. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
configTimeTransactionManagerHolder
protected static java.lang.ThreadLocal configTimeTransactionManagerHolder
- This will hold the TransactionManager to use for the currently configured
Hibernate SessionFactory. It will be set just before initialization
of the respective SessionFactory, and reset immediately afterwards.
LocalTransactionManagerLookup
public LocalTransactionManagerLookup()
getTransactionManager
public javax.transaction.TransactionManager getTransactionManager(java.util.Properties props)
- Specified by:
getTransactionManager
in interface net.sf.hibernate.transaction.TransactionManagerLookup
getUserTransactionName
public java.lang.String getUserTransactionName()
- Specified by:
getUserTransactionName
in interface net.sf.hibernate.transaction.TransactionManagerLookup
Copyright (C) 2003-2004 The Spring Framework Project.