Up to today I have been storing my Hibernate db connection in a session bean called DBConn, but I am finding that it is timing out quite often even though I have database connection pooling setup through Tomcat JNDI (using MySQL as DB).

What I am wondering is what practices others use in storing their DB connection in JSF apps. My thought is to grab a new connection at each request vs trying to store it in the FacesContext. I was going to do this by utilizing phase listeners - open my Hibernate session in the "Restore View" phase and close the session in the "Render Response" phase. This way there is no way I will ever get a timed out DB connection is what I am thinking.

What are other's thoughts on this, and what are others doing for a scalable DB connection mechanism?

TIA,
Aaron Bartell

Reply via email to