April 05
Prof. Ismael H. F. Santos -  ismael@tecgraf.puc-rio.br                                                          2
Wiring your Transaction Management
nFour transaction managers available
nDataSourceTransactionManager
nHibernateTransactionManager
nJdoTransactionManager
nJtaTransactionManager
n
n<bean id=“myTransactionManager"
n      class="org.springframework.orm.hibernate
n .HibernateTransactionManager">
n
n <property name=“sessionFactory">
n <ref local=“mySessionFactory"/>
n </property>
n</bean>
n
DataSourceTransactionManager - PlatformTransactionManager implementation for single JDBC data sources. Binds a JDBC connection from the specified data source to the thread, potentially allowing for one thread connection per data source.

HibernateTransactionManager- PlatformTransactionManager implementation for single Hibernate session factories. Binds a Hibernate Session from the specified factory to the thread, potentially allowing for one thread Session per factory. SessionFactoryUtils and HibernateTemplate are aware of thread-bound Sessions and participate in such transactions automatically. Using either is required for Hibernate access code that needs to support this transaction handling mechanism.

JdoTransactionManager - PlatformTransactionManager implementation for single JDO persistence manager factories. Binds a JDO PersistenceManager from the specified factory to the thread, potentially allowing for one thread PersistenceManager per factory. PersistenceManagerFactoryUtils and JdoTemplate are aware of thread-bound persistence managers and take part in such transactions automatically. Using either is required for JDO access code supporting this transaction management mechanism.

JtaTransactionManager - PlatformTransactionManager implementation for JTA, i.e. J2EE container transactions. Can also work with a locally configured JTA implementation. This transaction manager is appropriate for handling distributed transactions, i.e. transactions that span multiple resources, and for managing transactions on a J2EE Connector (e.g. a persistence toolkit registered as JCA Connector).