• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate: Accessing multiple databases within same transaction

 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm using Hibernate 3.2.5 ga, IBM WAS 6.1 and Oracle 10g. I need to access a couple of databases (different schema) for selects and updates. All these need to be within the same single transaction.

Is using two-phase commit the only way to achieve this? If yes, how would I be able to do so using Hibernate and Oracle 10g? Or are there other way out?

Here's what I think would work, please correct me, wherever I'm wrong:

1. Use the Oracle 10g thin driver (use XA driver).
2. Use the Hibernate Configuration class to load multiple configuration files (one for each database).
3. Write all CRUD codes within a single transaction.

Cheers!
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One solution you might look at is Hibernate Shards, which prides itself on its ability to persist data across multiple databases. It hasn't gone GA yet, but it's pretty solid.

-Cameron McKenzie
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Cameron Wallace McKenzie:
One solution you might look at is Hibernate Shards, which prides itself on its ability to persist data across multiple databases. It hasn't gone GA yet, but it's pretty solid.

-Cameron McKenzie


Actually I did take a look at it. But as you said, it's not GA yet, so its kinda difficult for me to use it for my current work.

So is 2-phase commit the only way out then? Are all steps ok?

Thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic