JPA Like Operator with Integer

前端 未结 4 1595
南旧
南旧 2020-12-11 06:52

Can someone tell me, why this is not working:

criteria.add(cb.like((myentity.get(\"integerid\")).as(String.class), \"2%\"))

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-11 07:19

    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

提交回复
热议问题