• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Using Single transaction accross multiple datasources

 
Greenhorn
Posts: 13
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,

I have to use spring and hibernate to delete two records from two different datasources , but this should be done in single transaction i.e if deletion of one record fails , the other should not be executed or should be rolledback.
Could any one please guide me how this can be achieved?

Thanks in advance
Yogesh Chavan
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Standard DataSources and Transaction Managers cannot do this.

You have to use DataSources and Transaction Manager that supports two phase commits. XA Transactions. Such a transaction manager would be a JTA Transaction Manager in an App Server, or a third party tx manager. And the DataSource resource has to be XA compliant.

Mark
 
yogessh chavaan
Greenhorn
Posts: 13
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Mark ,
I will look into XA transactions and JTA. if you have , can you please provide any links for references..with spring hibernate and JTA.

Yogesh
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

yogessh chavaan wrote:Thanks Mark ,
I will look into XA transactions and JTA. if you have , can you please provide any links for references..with spring hibernate and JTA.

Yogesh



There is nothing different between non JTA and JTA when it comes to Spring with Transactions. I recommend taking the "Core Spring" class, or reading SpringSource's documentation.

Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic