Uploaded image for project: 'Spring Data Couchbase'
  1. Spring Data Couchbase
  2. DATACOUCH-616

Positional parameters not detected inside SpEL expressions

    XMLWordPrintable

    Details

      Description

      @Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter} " +
       " #{#projectIds != null ? 'AND project IN $1' : ''} " +
       " #{#planIds != null ? 'AND ARRAY_LENGTH(ARRAY_INTERSECT(`plans`, $2)) > 0' : ''} " +
       " #{#active != null ? 'AND active = $3' : ''} " +
       " OFFSET $4 LIMIT $5")
       List<Phase> findAll(@Param("projectIds") List<String> projectIds, @Param("planIds") List<String> planIds, @Param("active") Boolean active, @Param("offset") Long offset, @Param("limit") Integer limit);
      
      @Query("SELECT COUNT FROM #{#n1ql.bucket} WHERE #{#n1ql.filter} " +
       " #{#projectIds != null ? 'AND project IN $1 : ''} " +
       " #{#planIds != null ? 'AND ARRAY_LENGTH(ARRAY_INTERSECT(`plans`, $2)) > 0' : ''} " +
       " #{#active != null ? 'AND active = $3' : ''} ")
       Long count(@Param("projectIds") List<String> projectIds, @Param("planIds") List<String> planIds, @Param("active") Boolean active); 

       

      The `findAll` query is correctly parsed, and receive positional parameters. OK
      The `count` query is incorrectly parsed and crash before execution. KO

       

      Error is the following :

      Found non terminating string literal starting at position 252\n\tat org.springframework.expression.common.TemplateAwareExpressionParser.skipToCorrectEndSuffix(TemplateAwareExpressionParser.java:208)
      

       

        Attachments

          Activity

            People

            Assignee:
            mikereiche Michael Reiche
            Reporter:
            JesusTheHun Jonathan MASSUCHETTI
            Last updater:
            Spring Issues Spring Issues
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: