Hi,
I'm using Hibernate with Spring managet JTA Transactions in Weblogic server. If I call an empty service-layer method from web-layer, one JTA transaction is created, as expected(PROPAGATION_REQUIRED). But if this method calls getHibernateTemplate().find("...), 4 transactions are created. So my problem is figuring out and eliminate the 3 additional transactions. My wish is that hibernate session would run in current transaction, which was created at the first place.
Any help or advice is appriciated.
Thank you.
My Transaction manager:
Code:
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="userTransactionName" value="java:comp/UserTransaction"/>
</bean>
Hibernate session factory:
Code:
<bean id="sessionFactory" depends-on="cacheManager"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="mappingLocations" value="classpath*:mappings/*.hbm.xml"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.cache.use_minimal_puts">true</prop>
<prop key="hibernate.hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</prop>
<prop key="hibernate.query.factory_class">
org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</prop>
</props>
</property>
</bean>
Interceptor:
Code:
<bean id="transactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>