• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Spring transaction for two SessionFactories

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am new to spring and hibernate. I am trying to copy data from one database to another. I have two datasources defined in the applicationContext file . I need to have a transaction across the two hibernate session factories so that once I insert into database 2, I can go ahead and delete from database 1, is this possible declaratively in spring ?

I tried it based on the example on the spring website and it does not work.

Thanks
Aadil
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, Spring supports JTA transactions across multiple datasources. You will need to use org.springframework.transaction.jta.JtaTransactionManager, which of course means you will need to have a JTA implementation available. If you are running within a full J2EE Server this shouldn't be a problem... if not you could always integrate a standalone JTA implementation such as JOTM.

For more information I suggest reading through the Spring Transaction Management Documentation.
[ April 18, 2006: Message edited by: Chris Mathews ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic