Skip to content

SQL parser fails on single quotes and raises Named parameter not bound #22450

Closed
@kancsuki

Description

@kancsuki

Affects: \Spring Boot 2.1.3


I'm getting an error with some JPQL queries which include the '%' characters (single quotes included). The problem seems to be, that the parser believes the named parameter is quoted out, even though it is not. The problem is somehow related with the number of characters, since when I change variable names or number of parameters the error comes and goes.

org.springframework.dao.InvalidDataAccessResourceUsageException: Named parameter not bound : __$synthetic$__19; nested exception is org.hibernate.QueryException: Named parameter not bound : __$synthetic$__19

I've created an example project which demonstrates this error: https://github.com/kancsuki/spring-parser-error-example

Note: I found that the following things could be related, but did not go any deeper.

  • org.springframework.data.repository.query.SpelQueryContext.SpelExtractor#quotations
  • org.springframework.data.jpa.repository.query.StringQuery.ParameterBindingParser#parseParameterBindingsOfQueryIntoBindingsAndReturnCleanedQuery

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions