Reputation: 802
I have a java web app running under Spring 2.5.6, Hibernate 3.4 (with Hibernate as the JPA provider), and Tomcat 6. I have it working with one DB schema / persistence unit but now need to connect to 2 schemas / persistence units. Can I do this without moving to a J2EE container such as JBoss or Glassfish? Will I need to use something like JOTM and global / XA transactions?
Upvotes: 2
Views: 1699
Reputation: 21
If you are using Tomcat with spring/hibernate, then use JBoss's Transaction Manager to create JTA transaction manager bean.
Here is a short tutorial http://ingenious-camel.blogspot.com/2012/01/how-to-use-jboss-transactions-in-spring.html
Upvotes: 2
Reputation: 570635
If you need to access multiple transactional resources within the same transaction, you'll need JTA and thus a JTA transaction manager. At the Spring level, this will mean using a JtaTransactionManager
instead of your JpaTransactionManager
. And if you don't want to move to a real Java EE app server, you'll have indeed to use a standalone transaction manager such as JOTM or Atomikos. I prefer the later but, personally, I would just move to GlassFish.
Upvotes: 4