|JPQL SQL Function does not accept or escape single qoutes [message #1823308]
||Tue, 24 March 2020 17:03
| Jeroen Benckhuijsen
Registered: March 2020
I'm running into the following issue: we're using EclipseLink and want to use the SQL() function to use PostgreSQLs native JSONB support in querying. For example:
Native query: SELECT ID, AGGREGATE, SCHEMAVERSION FROM TestEntity WHERE AGGREGATE->>'someValue' ILIKE ?
I've tried various ways to desribe this in JPQL using the SQL function, however I'm running into the issue I need to specific "-->' someValue' " which contains single quotes. When using these, the parser fails to recognize the JPQL as valid, and it doesn't seem to allow me to escape the single qoutes, e.g.:
JPQL: SELECT e FROM TestEntity e WHERE SQL('?->>\'someValue\' ILIKE ?', e.aggregate, :parameter)
Any suggestions? I am aware of being able to use native queries, however I would like to avoid this, as we're also looking into using the multi-tenancy features.
Powered by FUDForum
. Page generated in 0.01995 seconds