Hi-
I am having an issue in my application where every time I create an instance of the SessionFactory class, it creates 5 pooled database connections. I am using a homemade HibernateUtil class (like i have seen in many examples) to create and return this SessionFactory, and then using to get session objects from it. I am using tomcat servlets and they call a POJO business object class, which instantiates this session factory on each request. It is quickly becoming apparent that this is not the way to do things, so should I be saving the session factory to JNDI or something? can I do this with tomcat? How can I reuse the SessionFactory object so I don't kill my database with connections after a handful of servlet requests?
|