Sorry that I was not able to create a test case for this issue but I 'm pretty sure that there is an issue introduced in Hibernate 5.2.2 related to connection release when an SQLGrammarException is thrown. Steps to reproduce I discovered this in the following scenario : 1. Take a Spring application using JPA2 and hickaricp/c3p0 connection pool 2. Trigger an SQLGrammarException by messing up the schema 3. Each failed JPA query will leak one connection eventually starving the pool
I attached two test cases, run the log that shows how c3p0 detects the leak (the same as hickaricp) JPAUnitTestCase in each project . For now I will stick to version With hibernate 5.2.1.Final the connection pool does not get exhausted while using 5.2.2.Final the following error is obtained: "javax.persistence.PersistenceException: org.hibernate.HibernateException: The internal connection pool has reached its maximum size and no connection is currently available!"
I hope that this issue will be fixed, sorry but I can ' t spend more time working on hibernate to create a proper m pretty sure that the test case , I need it to "just work" replicates what is happening in the Spring application . |
|