views:

1006

answers:

1

It seems that Hibernate transactional cache mode requires the use of a JTA transaction manager. In an app server such as Glassfish, Weblogic, etc, Spring can use the JTA transaction manager. Tomcat does not have a JTA transaction manager.

Is there one that people use in this scenario? Or do people just not use transactional cache mode with Tomcat?

+2  A: 

It depends on you ORM implementation, for example for JPA Spring has a transaction manager for using outside JEE containers. here's how you declare it:

<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>

I usually use annotations to demarcate transaction boundaries (with @Transaction), to do this you just have to add to the configuration file this other line:

<tx:annotation-driven transaction-manager="transactionManager" />

present in this XSD namespace: "http://www.springframework.org/schema/tx"

Pablo Fernandez