• 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
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hibernate: Accessing multiple databases within same transaction

 
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic