I am using spring, hibernate and treecache in my application. I tried doing transaction management in two ways -
1. Initiate hibernate's JTA Transactions
a) Specified "hibernate.transaction.factory_class" property in LocalSessionFactoryBean. This property is for initiating hibernate JTA Transactions.
<prop key="hibernate.transaction.factory_class">net.sf.hibernate.transaction.JTATransactionfactory</prop>
b) Specified "hibernate.transaction.manager_lookup_class" property in LocalSessionFactoryBean. This property is used by hibernate to pass transaction manager to TreeCache
<prop key="hibernate.transaction.manager_lookup_class">net.sf.hibernate.transaction.WebsphereTransactionManagerLookup</prop>
c) Specified bean HibernateTransactionManager in applicationContext.xml and passed it to transactionInterceptor.
<bean id="hibernateTransactionManger" class="org.springframework.orm.hibernate.HibernateTransactionManager"><property name="sessionFactory"><ref local="sessionFactory"/></property></bean>
In this case when spring's HibernateTransactionManager is called, it delegates control to hibernate's JTA
2. Initiate spring's JTA Transactions
a) Specified "hibernate.transaction.manager_lookup_class" property in LocalSessionFactoryBean.
<prop key='hibernate.transaction.manager_lookup_class">net.sf.hibernate.transaction.WebsphereTransactionManagerLookup</prop>
b) Specified bean JtaTransactionManager in applicationContext.xml and passed it to transactionInterceptor.
<bean id="jtaTransactionManger" class="org.springframework.transaction.jta.JtaTransactionManager"/>
My code works well when i go for 1st option. However i want to use 2nd option(spring's JTA), which doesnt works. I get the following error - "could not release a cache lock" from SessionImpl.
|