Uploaded image for project: 'Olingo'
  1. Olingo
  2. OLINGO-1158

JPA Filter generate wrong escape instruction

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • V2 2.0.9
    • None
    • odata2-jpa
    • None

    Description

      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 '\\\\'

      Attachments

        Activity

          People

            Unassigned Unassigned
            tcouery Tanguy COUERY
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: