Criteria Query - Search for Integer using "like"
integer, jpa
Solution
I have not used this myself, but this other question:
Using JPA 2.0 Criteria API and cast causes generated JPQL to fail in Hibernate
Suggests using `.as(String.class)` after `root.get(filterKey)` to accomplish what you want.
If you're using Hibernate, be aware of reported bugs
Problem
How I can cast Integer to a String for Criteria Query? i.e.: ``` Predicate predicate = criteriaBuilder.like((Expression) root.get(filterKey), "%" + filterValue + "%"); ``` I wan to create filter for dataTable component.... and i.e. for ID value I want to get filter like this: If I type "1" I will get all items with ID containing "1" (223122 ID will be still correct)