I’m trying to select
a substring of column, i.e. select substring(description, 1, 200) from category where id=1
Is it possible to have a substring function within a select statement in JPQL/JPA 2? If yes, how? If no, are there any alternatives? Thanks.
Advertisement
Answer
There is a scalar expression for this: SUBSTRING(string, start, end)
I believe this is allowed in the SELECT clause in JPA 2.0, but not in JPA 1.0.