How do I share a Hibernate SessionFactory across web applications?
Posted
by Jer
on Stack Overflow
See other posts from Stack Overflow
or by Jer
Published on 2010-03-31T23:54:27Z
Indexed on
2010/04/01
0:33 UTC
Read the original article
Hit count: 362
I have two web applications that are running on a single Tomcat server and are connected to the same database with Hibernate. I am concerned that having two SessionFactory instances running around might cause some issues.
Also, since both web applications share much of the same application logic, I thought it would be a good idea to centralize as much as I could. And since I use Spring for DI and Hibernate configuration it would make sense to have a single ApplicationContext as well.
How would I go about doing something like this? Do I need to deploy a headless WAR that creates an ApplicationContext and thus a SessionFactory and allow each application access to it? Is this even a good idea?
© Stack Overflow or respective owner