hibernate jpa criteriabuilder ignore case queries

If the database contains German words with letters like Fußballschuhe in the column, java will modify the parameter in uppercase method to FUSSBALLSCHUHE and the query will not match. Lowercase will work in this case:

personCriteriaQuery.where(criteriaBuilder.like(
    criteriaBuilder.lower(personRoot.get(Person_.description)), 
    "%"+filter.getDescription().toLowerCase()+"%"));   

There is a CriteriaBuilder.upper() method:

personCriteriaQuery.where(criteriaBuilder.like(
    criteriaBuilder.upper(personRoot.get(Person_.description)), 
    "%"+filter.getDescription().toUpperCase()+"%"));

Tags:

Jpa