Query with Escape '\' fails in MySQL
------------------------------------

                 Key: OPENJPA-1295
                 URL: https://issues.apache.org/jira/browse/OPENJPA-1295
             Project: OpenJPA
          Issue Type: Bug
          Components: jdbc
    Affects Versions: 2.0.0
            Reporter: Fay Wang
             Fix For: 2.0.0


The following jpql fails in MySQL: 

Select e from Employee e where e.name LIKE :name ESCAPE '\'

The exception trace:

You have an error in your SQL syntax; check the manual that corresponds to your 
MySQL server version for the right syntax to use near ''\')' at line 1 
{prepstmnt 1239002810 SELECT t0.empId, t0.hireDate, t0.hireTime, 
t0.hireTimestamp, t0.name, t0.someLong, t0.statusId FROM SUBQ_EMPLOYEE t0 WHERE 
(t0.name LIKE ? ESCAPE '\') [params=(String) M\%%]} [code=1064, state=42000]
at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4587)
at 
org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4540)

The test case is 
org.apache.openjpa.persistence.query.TestQueryEscapeCharacters.testEscapedQuery 
 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to