Hi I am using a Filter to do this. There is a filter available on net call Persistance.java (search Google). I have slightly altered this to support multiple Hibernate configuration files (I have multiple databases). I also have an initialization servlet (loaded on startup) that initilalizez Hibernate. The Persistance filter takes care of opening a connection towards a database on request entry, and closes it on return.
Hermod -----Original Message----- From: Aaron Bartell [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 9:11 PM To: MyFaces Discussion Subject: Where to store DB connection in JSF session 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 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that the DnB NOR Group cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the virus programs used in the DnB NOR Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *