java.lang.IllegalStateException: Criteria parameter [org.hibernate.query.sqm.tree.expression.ValueBindJpaCriteriaParameter@xxxxxxx] not known to be a parameter of the processing tree

public List<T> execute(Session session) {
   CriteriaBuilder builder = session.getCriteriaBuilder();
   CriteriaQuery<T> cr = builder.createQuery(clazz);
   Root<T> root = cr.from(clazz);
   Predicate pred = builder.equal(root.get("property"), value)
   Query<T> query = session.createQuery(cr);
   cr.where(pred)
   return query.getResultList(); 
}


This fails with an exception

java.lang.IllegalStateException: Criteria parameter [org.hibernate.query.sqm.tree.expression.ValueBindJpaCriteriaParameter@41956b37] not known to be a parameter of the processing tree

//BaseSqmToSqlAstConverter.java

final SqmJpaCriteriaParameterWrapper<?> supplier = jpaCriteriaParamResolutions.get( expression ); // this map exists but is empty
if ( supplier == null ) {
	throw new IllegalStateException( "Criteria parameter [" + expression + "] not known to be a parameter of the processing tree" );
}
return supplier;

I can’t see any information or posts about this specific error message anywhere.

If I remove the predicate the query loads ok.

I’m on hibernate-core-6.5.2.Final and jakarta.persistence-api-3.1.0.jar

Hibernate ORM 6.5 is not supported anymore. Please update to the latest 6.6 or 7.1 version.

Hi, thank you for reply. I have updated to 6.6.31 and have the same issue.

The latest 6.6 version is 6.6.38.

I realised the problem…I had the where line after the query had already been created

Query<T> query = session.createQuery(cr);
cr.where(pred)
return query.getResultList(); ❌


cr.where(pred)
Query<T> query = session.createQuery(cr);
return query.getResultList(); âś…  

[My initial post actually had these lines the correct way, but my actual code was wrong - in trying to make a simple example from my code I inadvertently put them in the “correct” order. I have now edited my original post to show my incorrect code so if anyone searches this error it will be clear what the issue is]

1 Like