I am trying to write a JPQL query with a like clause:
LIKE \'%:code%\'
I would like to have code=4 and find
455
554
646
...
There is nice like() method in JPA criteria API. Try to use that, hope it will help.
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery criteriaQuery = cb.createQuery(Employees.class);
Root rootOfQuery = criteriaQuery.from(Employees.class);
criteriaQuery.select(rootOfQuery).where(cb.like(rootOfQuery.get("firstName"), "H%"));