ok, I am in a mood to rant about my travails in this matter, But I am choosing to cut the long story short.
It is very easy to setup a project that runs on Hibernate with the help of the multitude of beginner tutorials that come up on google search. And the settings and steps described there are good enough to carry you through your development schedule. But rememeber your hibernate settings are not production ready, i.e. not fit to be used on a machine that will stay turned on 24X7 and run your application in its Webserver container.
The problem you will face is this – You will deploy the application , and it will work smoothly. But shortly after a few hours, the DB will get disconnected with the following exception – detailed exception details here – http://pastebin.com/4KujAmgD
Hibernate Settings to be used to overcome the Communications Link Error are these
BUT, if you use these settings, and deploy your app, It will surely not work. Particularly if you use Hibernate 3. You have to do one more step -
Download the latest c3p0 tar.gz file from http://sourceforge.net/projects/c3p0/ Now put the c3p0-0.9.1.x.jar file into your Webcontents/WEB-INF folder.
Now when you deploy your application, it will work without failing. For explanations about what the above settings mean, refer to http://www.skill-guru.com/blog/2009/10/06/hibernate-tutorial-part-ii/