I'm using GlassFish v3 with Spring 2.5 and Hibernate. I have Spring managing my transactions for me but using the Platform Transaction Manager. My configuration is as follows:
<tx:jta-transaction-manager/>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>jdbc/myDataSource</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
.... mappings
<property name="hibernateProperties">
<props>
<prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.current_session_context_class">jta</prop>
<prop key="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.SunONETransactionManagerLookup</prop>
<prop key="hibernate.jndi.url">java:comp/TransactionSynchronizationRegistry</prop>
<prop key="hibernate.jdbc.use_get_generated_keys">false</prop>
<prop key="hibernate.cache.provider_class">com.intraxinc.common.da.dao.OSCacheProvider</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.order_updates">true</prop>
</props>
</property>
</bean>
My problem is that the transaction is not getting started. In the Spring class, org.springframework.orm.hibernate3.SessionFactoryUtils line 448, a call is made to the jtaTm.getTransaction(), jtaTm is an instance of com.sun.enterprise.transaction.TransactionManagerHelper. This method returns a null so no transaction is started. Why? Do I have something configured incorrectly or do I need to enable something in GlassFish to make the TransactionManager return to me a new Transaction?
Thanks for the help...
[Message sent by forum member 'fericit_bostan']
http://forums.java.net/jive/thread.jspa?messageID=473646