问题
In a JPQL query I tried to concatenate a string with a integer, using CONCAT JPQL function, in a select clause, for example:
SELECT CONCAT(c.idClient, ' ', c.name) FROM Clients c;
But the result is not a readable String.
Can we only use String in CONCAT function?
Thanks in advance.
回答1:
CONCAT is meant for Strings, the result of calling it with a number would most likely depend on your database.
You could try converting the id to a char first, you could use the FUNC function in EclipseLink to call a native function in your database that converts from numeric to char.
来源:https://stackoverflow.com/questions/5363113/jpql-we-cant-concatstring-integer-eclipselink