Skip to content

Sqlparser prohibits the use of syntax regulated by JPA (function cast) #3863

Open
@DmitryBelousov1992

Description

@DmitryBelousov1992

Attached you will find a reproducer that implements a sample application with JPA Entity "Item" containing field "date" and corresponding repository ItemRepository.
The repository contains only one method with query select "select i from Item i where cast(i.date as date) <= cast(:currentDateTime as date)".
Running this app leads to error

Caused by: org.springframework.data.jpa.repository.query.BadJpqlGrammarException: At 1:39 and token 'as', no viable alternative at input 'select i from Item i where cast(i.date *as date) <= cast(:currentDateTime as date)'; Bad EQL grammar [select i from Item i where cast(i.date as date) <= cast(:currentDateTime as date)]

'org.springframework.boot' version '3.4.5'

EQLParseError.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions