Tanguy COUERY created OLINGO-1158: ------------------------------------- Summary: JPA Filter generate wrong escape instruction Key: OLINGO-1158 URL: https://issues.apache.org/jira/browse/OLINGO-1158 Project: Olingo Issue Type: Bug Components: odata2-jpa Affects Versions: V2 2.0.9 Reporter: Tanguy COUERY
Hello, substringof filter or startswith generate and error on MariaDB / MySql. For exemple : ~LogUsers?$skip=0&$top=20&$filter=substringof(%27test%27,Mail)~ Generate this SQL query : ~Hibernate: select loguser0_.id as id1_2_, loguser0_.action as action2_2_, loguser0_.actionDate as actionDa3_2_, loguser0_.mail as mail4_2_, loguser0_.ref as ref5_2_, loguser0_.status as status6_2_ from LogUser loguser0_ where case when loguser0_.mail like concat('%', concat('test', '%')) escape '\' then 1 else 0 end=1 order by loguser0_.id limit ?~ This throw an exception in MariaDB / MySql (reproduce also with PostgreSql) ~ERROR: (conn:3) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''\' then 1 else 0 end=1 order by loguser0_.id limit 20' at line 1~ In the java code the ESCAPE '\\' should be replaced by ESCAPE '\\\\' -- This message was sent by Atlassian JIRA (v6.4.14#64029)