Can someone tell me, why this is not working:
criteria.add(cb.like((myentity.get(\"integerid\")).as(String.class), \"2%\"))
Here are example of how it work with JPA, so u can use LIKE with integer inside your JPQL.
public List getMyEntities(String idStr) {
return entityManager.createQuery("SELECT m FROM MyEntity m WHERE CAST( m.id AS string ) LIKE :idStr")
.setParameter("idStr", "%" + idStr+ "%").getResultList();
}
Note: i tested it and worked fine with me, i am using JPA 2.1 with Hibernate provider.