File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using Single transaction accross multiple datasources

 
yogessh chavaan
Greenhorn
Posts: 13
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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 Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic