Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>If I stop and restart Tomcat, reinitializing my servlet and rebuilding my session factory, everything works fine. It is almost like the session factory itself is timing out? </p> </blockquote> <p>It's not the session factory but the connections used by the session factory (e.g. MySQL is well known to timeout connections after 8 hours of inactivity by default). Either:</p> <ul> <li>use a connection pool that is able to validate connections on borrow and to renew them ~or~</li> <li>increase the idle timeout on the database side</li> </ul> <hr> <blockquote> <p>OK. Suppose I use a c3P0 connection pool. How do I specify in the hibernate.cfg.xml file that I want to "validate connections on borrow" or does it do this by default?</p> </blockquote> <p>The various options when using C3P0 are documented in <a href="http://www.mchange.com/projects/c3p0/index.html#configuring_connection_testing" rel="nofollow">Configuring Connection Testing</a>. My advice would be to use the <a href="http://www.mchange.com/projects/c3p0/index.html#idleConnectionTestPeriod" rel="nofollow"><code>idleConnectionTestPeriod</code></a> parameter:</p> <blockquote> <p>The most reliable time to test Connections is on check-out. But this is also the most costly choice from a client-performance perspective. Most applications should work quite reliably using a combination of <code>idleConnectionTestPeriod</code> and <code>testConnectionsOnCheckIn</code>. Both the idle test and the check-in test are performed asynchronously, which leads to better performance, both perceived and actual.</p> <p>Note that for many applications, high performance is more important than the risk of an occasional database exception. <strong>In its default configuration, c3p0 does no Connection testing at all. Setting a fairly long <code>idleConnectionTestPeriod</code>, and not testing on checkout and check-in at all is an excellent, high-performance approach</strong>.</p> </blockquote> <p>To configure C3P0 with Hibernate, be sure to read <a href="http://www.mchange.com/projects/c3p0/index.html#hibernate-specific" rel="nofollow">the relevant instructions</a> (and to use the appropriate properties, and the appropriate files).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload