I have a numeric id
field in an entity that I want to concatenate to some other string. Right now I'm doing:
cb.concat(
from.get("id").as(String.class)
, otherString
)
That works and it is translated to CAST(mytable.id AS VARCHAR(255)
.
I want to be able to cast it to a varchar of lenght 20 VARCHAR(20)
, because the performance of the query improves exponentially.
Any idea on how to do it?