Can someone tell me, why this is not working:
criteria.add(cb.like((myentity.get(\"integerid\")).as(String.class), \"2%\"))
My guess : you are trying to put a String in integerId which is a Integer.
Moreover, a like on an integer value is not possible.
Change your String.class to Integer.class. and "2%" by an integer value