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

Use only two parameters in CONCAT function of JPA Where Expressions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • V2 2.0.6
    • V2 2.0.7
    • odata2-jpa
    • None
    • Patch

    Description

      Substring filters such as the one below:

      $filter=(substringof(%27Jan%27,FirstName)
      

      Are translated into JPA where clauses similar to:

      Where case when first_name like concat('%', 'Jan', '%') then 1 else 0 end=1 
      

      However, not all database support concat functions with more than 2 parameters. The SAP Hana database is one of them:

      I would propose to turn the where clause into:

      Where case when last_name like concat('%', concat('Jan', '%')) then 1 else 0 end=1
      

      to get the clause to run on more database platforms:

      Patch included in the attachments

      Attachments

        Activity

          People

            mirbo mibo
            jpenninkhof Jan Penninkhof
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified