views:

64

answers:

1

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?

+2  A: 

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.

Pascal Thivent