Hibernate / MySQL connection timeouts — Trying to deal with thread-pooled executors not releasing Hibernate connections to C3P0 after exit
I have a Tomcat application that uses MySQL, and Hibernate for ORM. The nature of our application demands that we have to pull and aggregate a lot of analytics data from a NoSQL store for each request , so we split the pulling and aggregating for each request into several tasks and delegate those to a thread-pooled executor service. When each thread performs a task, it needs to query / update MySQL regarding certain things so it borrows Hibernate sessions from C3P0 ( which we use for connection pooling ). Essential config : <property name="current_session_context_class">thread</property>