Oct 14th, 2004, 09:32 AM
Multiple datasources and thus multiple sessionFactories
We are using 2 datasources and therefore defined 2 different sessionFactories in the application context files.
Problem is that OpenSessionInViewFilter can only fetch 1 sessionFactory.
How can we solve this within the logic of the framework ?
Subclass OpenSessionInViewFilter so that it can fetch a list of sessionFactories.
Oct 14th, 2004, 07:52 PM
You could configure two filters. When OpenSessionInViewFilter fires, it creates a new Hibernate session (if none can be found) and registers it within TransactionSynchronizationManager using sessionFactory as the key. Since you are using two sessionFactories, you can use two Hibernate Session at the same time.