I'm tying to use CriteriaBuilder for a case insensitive query as described here hibernate jpa criteriabuilder ignore case queries and in many other questions and tutorials around the web.
My code is:
public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
return builder.equal(builder.upper(root.get("firstName")), "test".toUpperCase());
}
but I'm getting a compile time error:
The method upper(Expression<String>) in the type CriteriaBuilder is not applicable for the arguments (Path<Object>)
The version of hibernate jpa I'm using is:
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
Does it depend on the hibernate version I'm using? How to put an Expression<String> there instead of a Path<Object>?
Thank you for your help