title: How to configure c3p0 in hibernate to auto-refresh stale DB connections
body: <p>I am using hibernate 3, c3p0 9.1.2, Oracle 11g in my application. If I restart the Oracle then the stale connections are not getting refresh and I am getting exception "java.sql.SQLRecoverableException: Closed Connection". Below is my hibernate.cfg.xml. </p>
  
  <p>I am a beginner in Hibernate API. Can you please suggest how to configure hibernate to automatically refresh the stale connections on a specified time.</p>
  
  <p>Here is my hibernate.cfg.xml</p>
  
  <p>
  </p>
  
  <p>
      
          oracle.jdbc.driver.OracleDriver
          jdbc:oracle:thin:@localhost:1521:ems
          emsman</p>
  
  <pre><code>&lt;property name="hibernate.c3p0.idle_test_period"&gt;60&lt;/property&gt; &lt;!-- seconds --&gt;
      &lt;property name="hibernate.c3p0.min_size"&gt;5&lt;/property&gt;
      &lt;property name="hibernate.c3p0.max_size"&gt;20&lt;/property&gt;
      &lt;property name="hibernate.c3p0.timeout"&gt;1800&lt;/property&gt;
      &lt;property name="hibernate.c3p0.max_statements"&gt;50&lt;/property&gt;
      &lt;property name="show_sql"&gt;false&lt;/property&gt;
      &lt;property name="dialect"&gt;org.hibernate.dialect.OracleDialect&lt;/property&gt;
  
      &lt;property name="c3p0.validate"&gt;true&lt;/property&gt;
  
  &lt;mapping resource="&lt;package-name&gt;/GroupOpWorkflow.hbm.xml"/&gt;
      &lt;mapping resource="&lt;package-name&gt;/GroupOperation.hbm.xml"/&gt;
      &lt;mapping resource="&lt;package-name&gt;/GroupOpNode.hbm.xml"/&gt;
      &lt;mapping resource="&lt;package-name&gt;/NodeStatusLog.hbm.xml"/&gt;
  &lt;/session-factory&gt;
  </code></pre>
  
  <p></p>