My app currently handles its users in its own db. I'm in the process of creating a CAS app that will centralize the managing of users for my app and others. This CAS app will use a db of its own and the other apps will have access to it. I use the same hibernate entity "User" for all the apps including the CAS.
My goal is to be able to configure whether an app will use the "local" db or the "cas" db when looking for the "User" entity.
This configuration doesn't have to be changed at run time. it can be a spring context xml config (or just a different set of imports).
I don't want to use additional session factories. I tried to walk down that road and got stuck once I realized I would need to define more open-in-session-view filters in the web.xml - one per factory.
How can I configure the single session factory to load this Entity (and maybe some other related ones) from a different data source based on some configuration?