Skip to content

JPQL and EQL parser reject CAST function #3863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DmitryBelousov1992 opened this issue Apr 30, 2025 · 1 comment
Closed

JPQL and EQL parser reject CAST function #3863

DmitryBelousov1992 opened this issue Apr 30, 2025 · 1 comment
Assignees
Labels
type: bug A general bug

Comments

@DmitryBelousov1992
Copy link

DmitryBelousov1992 commented Apr 30, 2025

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 30, 2025
@mp911de mp911de self-assigned this May 5, 2025
@mp911de mp911de added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels May 5, 2025
@mp911de mp911de changed the title Sqlparser prohibits the use of syntax regulated by JPA (function cast) JPQL and EQL parser reject CAST function May 9, 2025
@mp911de mp911de added this to the 3.4.6 (2024.1.6) milestone May 9, 2025
mp911de added a commit that referenced this issue May 9, 2025

Verified

This commit was signed with the committer’s verified signature.
mp911de Mark Paluch
We now define arithmetic, string, and typed cast functions to support all potential variants of casting supported by JPQL and EQL.

Closes #3863
mp911de added a commit that referenced this issue May 9, 2025

Verified

This commit was signed with the committer’s verified signature.
mp911de Mark Paluch
We now define arithmetic, string, and typed cast functions to support all potential variants of casting supported by JPQL and EQL.

Closes #3863
@mp911de mp911de closed this as completed in b0a2922 May 9, 2025
@mp911de
Copy link
Member

mp911de commented May 9, 2025

That's fixed now.

mp911de added a commit that referenced this issue May 13, 2025

Verified

This commit was signed with the committer’s verified signature.
mp911de Mark Paluch
We now define arithmetic, string, and typed cast functions to support all potential variants of casting supported by JPQL and EQL.

Closes #3863
mp911de added a commit that referenced this issue May 15, 2025

Verified

This commit was signed with the committer’s verified signature.
mp911de Mark Paluch
We now define arithmetic, string, and typed cast functions to support all potential variants of casting supported by JPQL and EQL.

Closes #3863
mp911de added a commit that referenced this issue May 16, 2025

Verified

This commit was signed with the committer’s verified signature.
mp911de Mark Paluch
We now define arithmetic, string, and typed cast functions to support all potential variants of casting supported by JPQL and EQL.

Closes #3863
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants