The proxy ResultSet returned from any of the Statement/PreparedStatement/CallableStatement implementations (executeQuery, getResultSet, getGeneratedKeys) does not intercept the getStatement call in the returned ResultSet, so the un-proxied statement is leaked to the caller. This was discovered as part of https://hibernate.atlassian.net/browse/HHH-18325 which has highlighted that the 'equals' checks in the proxied Statement do not take into account a call to perform a comparison with a non-proxied object (e.g. performing `proxiedStatement.equals(proxiedStatement.getResultSet().getStatement())` throws an exception rather than returning a true/false value).
Proposed fix: https://github.com/apache/tomcat/pull/742
*** Bug 65347 has been marked as a duplicate of this bug. ***
Fixed in: - 11.0.x for 11.0.0-M23 onwards - 10.1.x for 10.1.27 onwards - 9.0.x for 9.0.92 onwards