Open manosbatsis opened 1 year ago
The asterisk is treated by the FIQL parser as a wildcard (and the operator becomes a prefix query). For in-memory evaluation of the filter, Elide attempts to coerce any argument compared against a wildcard to a String.
The other place the wildcard is evaluated is in the JPQL generation for filtering directly against the database:
GLOBAL_OPERATOR_GENERATORS.put(PREFIX, new CaseAwareJPQLGenerator(
"%s LIKE CONCAT(%s, '%%')",
CaseAwareJPQLGenerator.Case.NONE,
CaseAwareJPQLGenerator.ArgumentCount.ONE,
true)
);
That looks like where the problematic String conversion is happening. You can override the JPQL generation for any model field to work around this:
https://elide.io/pages/guide/v7/16-performance.html#jpql-fragment-override
Consider a (kotlin) enum:
and it's use in some entity:
Current Behavior
This works:
/api/reserve?filter[myentity]=symbol==FOO
but this:
/api/reserve?filter[myentity]=symbol=ini=FOO*
thows the exception bellow. Seems the query visitor makes a string-type assumption because of the operator:
Your Environment