Does it ever make sense or better yet is it possible to share the Session Factory among multiple Web Applications? For instance, I have written multiple Struts apps that are unique and should not be grouped, but they do have one thing in common, they all share the same DB. Is it necessary to load the entire mapping into memory for each app or is there a way around this?
I tried removing the <listener> from all but one app and monitored tomcat while exercising the app. When Tomcat starts it Configures Hibernate from the remaining <listener>, but when one of the other apps tries to create a session from the SessionFactory it maps the entire DB into memory.
I also tried creating an app that contained the <listener> with a web page to links to all the other apps. That way you would be sharing the same Interent Explorer (Http) session. Yes, I realize that a Hibernate Session is not the same as the Http Session, but what the heck I gave it a try and had no luck.
F.Y.I. I am using Hibernate3 with Tomcat 5.5 and I have implemented the <listener> to load the Configuration on deployment.
Thanks for your time!
|