i noticed this also can cause an error
NativeQueryImplementor query = (NativeQueryImplementor) em.createNativeQuery( sqlString ); NativeQuery sqlQuery sqlQuery = em.unwrap( Session.class ).createSQLQuery( sqlString ); sqlQuery.setLong(1, page.getId()); query.setLong(1, page.getId()); // nit fails because ParameterMetadata isZeroBasedParametersIndex =was changed to true by the Session#createSQLQuery;
I changed the PR, now the QueryPlanChache#getSQLParameterMetadata(final String query) returns a copy of the ParameterMetadata;