1

Possible Duplicate:
Hibernate + Spring using multiple datasources?

How can i set two datasource for the same project in hibernate with spring.I just want to use one datasource for h2 and another for mysql is it possible to manage two datasource for same application.

Community
  • 1
  • 1
Kamalam
  • 1,254
  • 6
  • 18
  • 32
  • [Hibernate Spring Multiple Datasources](http://stackoverflow.com/questions/860918/hibernate-spring-using-multiple-datasources) – Bharat Sinha Aug 11 '12 at 16:04

1 Answers1

0

Yes but you need to set up a SessionFactory for each datasource

Eran Harel
  • 2,325
  • 19
  • 28
  • if i set up a sessionFactory for each datasource will every hibernate transaction affects both the database or do i have to mention which datasource to be connected for each transactions. – Kamalam Aug 12 '12 at 08:18
  • If you work with several SessionFactories / DataSources and want perform distributed transactions (perform a transaction across multiple DB connections) you need to use a DataSource that supports XA transactions and set up Spring TX manager appropriately. – Eran Harel Aug 13 '12 at 09:09