| Hi,
 I'm posting this to confirm some session / connection pooling behavior that I have debugged in my Hibernate implementation. I'd appreciate a confirmation if this is correct (or a correction if it is not)
 
 Assumptions - Hibernate with C3P0 for connection pooling, with min and max of the pool set to 1.
 
 The original Hibernate integration interface I wrote would keep an individual session alive for extensive periods of time. I have since re-thought this strategy, but it is not relevant to the behavior at hand.
 
 Our DB terminates connections that are idle for more than 30 minutes. If I were to create a session instance, do a couple of retrievals, and then let the session sit idle for 30 minutes, I would get a Socket exception (or something) indicating that the connection has been dropped.
 
 For some time I tried to get C3P0 to validate and test the connection, but then I realized that C3P0 will only test / validate connections that were not already in use by a session. As I was keeping sessions around for long periods of time, C3P0 would assume that the session was in use and not perform any testing / validation on it. This matches the behavior that I am seeing, so is this correct?
 
 For those that are interested, I am moving towards transient sessions - only keeping them alive long enough to perform a current transaction and then kill it. As business objects in my environment tend to live beyond the space of a single transaction this implies that I will have to manage connecting them to the current session when something interesting needs to be done.
 
 
 |