title: HibernateOptimisticLockingFailureException marks connection as 'closed'?
body: <p>I'm getting the following stack trace:</p>
  
  <pre><code>org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Object of class [com.btfin.wrapcore.request.MFRequest] with identifier [2850448]: optimistic locking failed; nested exception is org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.btfin.wrapcore.request.MFRequest#2850448]
    at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:672)
    at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:793)
  </code></pre>
  
  <p>Which is due to an optimistic locking exception. I can address the root cause of this. </p>
  
  <p>My question is - in this scenario - the exception handling sets the database connection to 'closed'. (Which causes issues with my connection pool). </p>
  
  <p>What is the pattern for handling a database exception like <code>HibernateOptimisticLockingFailureException</code> that bubbles up through spring and hibernate and returns a closed connection? </p>
  
  <p>Do you know the part in the Spring/Hibernate code that sets the connection to closed?</p>