Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Spring transaction for two SessionFactories

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic