I am wondering if Spring's hibernate support can handle Multiple Data Sources. From what I saw in the source code, HibernateTemplate only supports one sessionfactory. Dynamically changing the DataSource in that SessionFactory variable may cause thread problem. I am wondering if anybody has good idea on supporting multiple DataSources in Spring/Hibernate environment.
My requirement for multiple data sources is pretty strightforward. We have a Transaction data model, which holds tens of millions of records (hundreds of giga bytes) and is growing. We have 3 DB servers holding those data. Same exact table DDL, same RDBMS. When a user login, based on his input, we need to grab data from the three DBs. One user may have data stored in DB1 and DB2 and DB3.
Idealy, I would think we should have three Sessionfactories for those three DBs, and use diferent SessonFactory for different data request. I am just thinking how to do it elegantly using Spring/Hibernate.
I remember I read some where int he forum Spring/Hibernate supports some kind of switch based on user credential ( I could be totally wrong). But I couldn't find it...