• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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 ]
 
Beware the other head of science - it bites! Nibble on this message:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic