Hi Tom,
the current EJBQL grammar is too restrictive when parsing the arguments
of functions CONCAT, SUBSTRING, ABS, LENGTH, LOCATE, and SQRT. E.g. it
does not allow input parameters as CONCAT arguments, or it does not
allow specifying the start position for LOCATE, etc. I changed the
grammar to match what the spec allows. You find the changes attached,
please have a look.
There is one issue with LOCATE. I use method Expression.locate taking
two arguments to map an EJBQL LOCATE with a start position:
SELECT c.name FROM Customer c WHERE LOCATE('Mi', c.name, 1) = 1
This results in a SQLException with text "ORA-00904: "LOCATE": invalid
identifier" when running on an Oracle database. The generated SQL is
SELECT NAME FROM CMP3_CUSTOMER WHERE (LOCATE('Mi', NAME, 1) = 1)
A LOCATE w/o start position works fine on Oracle. It is mapped to
Expression.indexOf which generates the SQL INSTR function.
Regards Michael