org.springframework.orm.hibernate
Class LocalTransactionManagerLookup
- public class LocalTransactionManagerLookup
- implements 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.
- Author:
- Juergen Hoeller
- Since: 21.01.2004
- See Also: LocalSessionFactoryBean.setJtaTransactionManager(javax.transaction.TransactionManager), org.springframework.transaction.jta.JtaTransactionManager.setTransactionManager(javax.transaction.TransactionManager)
LocalTransactionManagerLookup
public LocalTransactionManagerLookup()
getTransactionManager
public TransactionManager getTransactionManager(Properties props)
getUserTransactionName
public String getUserTransactionName()
to Class java.lang.ThreadLocal- 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.
to Class javax.transaction.TransactionManager