I have a JNDI datasource defined in my tomcat/conf/context.xml that shares connections with all of our web applications. I have just written a new part of two of the applications using Hibernate 4.1.10. I have a listener in my web.xml that creates the SessionFactory. Since webapps can't share the factory, the two applications each have a SessionFactory. The problem I'm having is that when I start up tomcat each of the applications with hibernate grab 30 connections. When I start running a web applications that uses straight JDBC connections it also grabs 30 connections. If I run the applications without the hibernate modifications, then there are a total of 30 connections that are shared between all applications. What do I need to do to get Hibernate to share its pool of connections with the other apps?
I'm running Tomcat 6, Hibernate 4.1.10, Postgresql 8.3, and C3P0.
|