I have two databases that I read from. The software that I am working on is designed to connect to the primary, we'll call internal, database when the web application starts. The user logs and and connects to a secondary, we'll call external, database at some point in the application.
I have an OpenSessionInViewFilter setup which takes care of the internal database, as I load up applicationContext-internal via web.xml when the application loads. However, the way that I am doing it now, on the pages that deal with the external database, I am manually getting applicationContext-external in each controller that needs it, and opening a session for that controller, and I am explicitly calling collections to hydrate them, before returning the view.
So, my question is, is there a way to add a session to the current OpenSessionInView.
Does anyone see another way for me to do what I need to do here?
Can I add and remove the applicationContext-external to the applicationContext at runtime and have those classes that are mapped to the external database loaded when necessary?
Thanks.
~ Mike
|