Hibernate 6.1.6: Using jakarta criteria and count query, getting exception in count query execution if count query contains where predicate

You can’t use the same restriction Predicate that you built for one query in the other. You have to rebuild the restriction again, based on the Root/From of the query you want to apply this on.

1 Like