title: hibernate c3p0 broken pipe
body: <p>I'm using hibernate 3 with c3p0 for a program which constantly extracts data from some source and writes it to a database.
  Now the problem is, that the database might become unavailable for some reasons (in the simplest case: i simply shut it down).</p>
  
  <p>If anything is about to be written to the database there should not be any exception - the query should wait for all eternity until the database becomes available again.
  If I'm not mistaken this is one of the things the connection pool could do for me: if there is a problem with the db, just retry to connect - in the worst case for infinity.</p>
  
  <p>But instead i get a broken pipe exception, sometimes followed by connection refused and then the exception is passed to my own code, which shouldn't happen.</p>
  
  <p>Even if I catch the exception, how could i cleanly reinitialize hibernate again? (So far without c3p0 i simply built the session factory again, but i wouldn't be surprised if that could leak connections (or is it ok to do so?)).</p>
  
  <p>The database is Virtuoso open source edition.</p>
  
  <p>My hibernate.xml.cfg c3p0 config:</p>
  
  <pre><code>&lt;property name="hibernate.connection.provider_class"&gt;org.hibernate.connection.C3P0ConnectionProvider&lt;/property&gt;  
  &lt;property name="hibernate.c3p0.breakAfterAcquireFailure"&gt;false&lt;/property&gt;
  &lt;property name="hibernate.c3p0.acquireRetryAttempts"&gt;-1&lt;/property&gt;
  &lt;property name="hibernate.c3p0.acquireRetryDelay"&gt;30000&lt;/property&gt;
  &lt;property name="hibernate.c3p0.automaticTestTable"&gt;my_test_table&lt;/property&gt;
  
  &lt;property name="hibernate.c3p0.initialPoolSize"&gt;3&lt;/property&gt;
  &lt;property name="hibernate.c3p0.minPoolSize"&gt;3&lt;/property&gt;
  &lt;property name="hibernate.c3p0.maxPoolSize"&gt;10&lt;/property&gt;
  </code></pre>
  
  <p>btw: The test table is created and i get tons of debug output- so it seems it actually reads the config.</p>