title: How to get a new Connection from Hibernate SessionFactory after the DB restart without restarting the tomcat?
body: <p>In my web application I am using hibernate &amp; spring. The Hibernate <code>SessionFactory</code> object is being injected as a spring bean at the time of tomcat server start up. Normally it is working fine. But the problem arises when I shut down or even restart my database.</p>
  
  <p>After restarting my database if I retrieve a session from Hibernate <code>SessionFactory</code> object and want to execute query i am getting <code>org.hibernate.exception.JDBCConectionException: Could not execute query exception</code>.
  To overcome this problem I need to restart the tomcat server. After restart it creates the new <code>SessionFactory</code> object, so I don’t get the exception.</p>
  
  <p>In a situation how can I get a new fresh connection with the database, so that I don’t need to restart the server again &amp; again.</p>