Hibernate Gives Connection Pool Error: Timeout waiting for idle object

Bug: Hibernate connection times out (after the maxWait duration set for the datasource), and gives error message in the log – “Timeout waiting for idle object”

Reason: Some operations were done using Hibernate session instead of Spring HibernateTemplate ; which were obtained using HibernateTemplate.getSession() function, and were not released by calling the HibernateTemplate.releaseSession();

Solution: Call this.releaseSession() from inside a spring-hibernateDao after the db operations. (ideally in a finally block).

Kj [/.] Sreekumar programs computers as a hobby and profession. Into programming from his school days, Sree uses Codemarvels to key in facts and fixes he finds interesting while working on different projects. Some of the articles here give away a few shades of his philosophical leanings too.

Leave a Comment

Your email address will not be published. Required fields are marked *