Thursday, March 06, 2008

Transaction Management with Spring and Hibernate

Spring and Hibernate have features supporting Transaction Management. However Neither of them has a Transaction Manager and hence it on it's own cannot support XA Transactions (Global Transactions). If you like to use XA Transactions you need to use JTA service along with Spring or Hibernate. That means you have to run your application on a J2EE Application Server. There are some stand alone JTA implementations are available though (eg: JOTM, Atomikos).Without JTA Spring and Hibernate can support only local transactions. That means you have only one resource manager. Even though it looks very reasonable that may not be the case. Most of the enterprise applications shall be using one database and JMS (JMS is a resource manager). If you are having database and JMS you require XA Transaction (of course if you are using JMS for transactional purpose)

No comments: