Can someone tell me, why this is not working:
criteria.add(cb.like((myentity.<Integer>get("integerid")).as(String.class), "2%"))
I get the following error:
The object [2%], of class [class java.lang.String], from mapping [org.eclipse.persistence.mappings.DirectToFieldMapping[integerid-->MYENTITY.INTEGERID]] with descriptor [RelationalDescriptor(org.example.model.MyEntity --> [DatabaseTable(MYENTITY)])], could not be converted to [class java.lang.Integer]
Is the only solution to change the myinteger
property to a string in the model, in order that I can use the like
operator?
BR
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…