1

I am trying to develop a small program that performs queries on multiple MySQL databases stored on a single server. For instance, consider having a select statement that retrieves values from fields in table X1 in database D1, and fields in table X2 in database D2.

We are using Spring 3 as our framework in addition to Hibernate 3.5. How would I go about setting up a spring/hibernate project to achieve this?

I have seen many sources state needing separate hibernate configurations / session factories for each DB, and to use a transaction manager such as Atomikos. But I have not been able to find any clear direction / instructions.

Thanks for any help provided! (I can provide more info if requested)

A. Cusano
  • 87
  • 1
  • 7

1 Answers1

0

You will need atomikos if you will perform updates not only queries on multiple dbs. For read only usage imagine you do not use hibernate.then you will need x db connections for your x dbs. Same with hibernate,it will need x connections so you wil have x session factories configured for each db. You might add atomikos as transaction manager if you use spring cause then if you will annotate your service method as transactional read only at the end xof the transaction the connection iscrelesed to the connection pool...

Cris
  • 4,947
  • 6
  • 44
  • 73