Reputation: 16196
I would like to write a JPQL query like this:
SELECT f
FROM Foo f
WHERE f.bar LIKE '[:bar]%'
This cannot be parsed properly by EclipseLink, which can't figure out that the trailing ]%
is actually not part of the named parameter name.
I am aware of the ESCAPE
keyword, but I'm not sure that would fix my problem. What are my spec-sanctioned options?
Upvotes: 1
Views: 64
Reputation: 707
I'd say: create your query object with your query:
SELECT f FROM Foo f WHERE f.bar LIKE :bar
And then set the "bar" parameter by calling
query.setParameter("bar", "["+bar+"]%");
Upvotes: 1