I am using "javax.persistence.lock.timeout" property which can cause "org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.getResultSet()" to throw "SQLGrammarException: could not extract ResultSet". This is valid and expected behavior but prevents creating SqlStatementWrapper in executeQueryStatement() ( AbstractLoadPlanBasedLoader:186 ) and that in turn means that no statement is released in finally section: AbstractLoadPlanBasedLoader.java:138 and one was created in ( AbstractLoadPlanBasedLoader.java:185 ) Additionally getResultSet() releases statement on its own in case of SQLException but not HibernateException/org.hibernate.exception.SQLGrammarException ( AbstractLoadPlanBasedLoader:L446 ) |