Hi,
I am using, Jboss 4.0.4, Hibernate 3, Spring 2.0, Java 1.5.
I had a exception when I tried to save an object that stated tried to close hibernate session: Hibernate session already closed. So I did some searches on the forums and found out that I probably had two Transaction Manager running at the same time. One in Jboss (JTA and Hibernate Transaction Manager) and the suggestion were to take one out. I figure that I should take out the JTA and only use the Hibernate Transaction Manager that i configured in Spring. This caused me a lat of errors and exception. So I started look in to change to only use the JTA instead. I found some posting on how to configure this, but now I get another exception.
My configuration look like this:
<!-- DATASOURCE -->
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>java:OracleDS</value>
</property>
</bean>
<!-- TRANSACTIONS -->
<!-- <bean id="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
-->
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTran sactionManager">
<property name="transactionManagerName" value="java:/TransactionManager">
</property>
<property name="userTransactionName" value="UserTransaction"></property>
</bean>
<bean id="sessionFactory" class="org.springframework.jndi.JndiObjectFactoryB ean">
<property name="jndiName">
<value>java:/hibernate/MyCompanySessionFactory</value>
</property>
<property name="jtaTransactionManager">
<bean factory-bean="transactionManager" factory-method="getTransactionManager"/>
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.Hibernat eTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory"/>
</property>
</bean>
Thanks
Jacob


Reply With Quote
