Skip to content

error when using reserved words (JPQL aggregate functions) in entity field names and packages #34730

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 8, 2025 · 1 comment
Labels
for: external-project Needs a fix in external project

Comments

@DmitryBelousov1992
Copy link

DmitryBelousov1992 commented Apr 8, 2025

The following errors were found during migration to springboot 3.x.:

  • BadJpqlGrammarException: Line 1:43 no viable alternative at input 'ie.object'; Bad JPQL grammar [select ie from ItemExample ie left join ie.object io where io.externalId = :externalId]
    for
    @query("select ie from ItemExample ie left join ie.object io where io.externalId = :externalId")
    Page findPageByExternalId(@param("externalId") String externalId, Pageable pageable);

  • BadJpqlGrammarException: Line 1:63 no viable alternative at input 'ie.status=com.app.domain.object'; Bad JPQL grammar [select ie from ItemExample ie where ie.status = com.app.domain.object.Status.UP]
    for
    @query("select ie from ItemExample ie where ie.status = com.app.domain.object.Status.UP")
    Page findByStatusUp(Pageable pageable);

I am attaching an example springboot 3.x application with detailed comments and examples of errors and workarounds found in the file com.app.repo.ItemExampleRepository.
https://github.com/DmitryBelousov1992/SpringReservedWordsExampleErrors.git

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 8, 2025
@jhoeller
Copy link
Contributor

jhoeller commented Apr 8, 2025

@Query is a feature of Spring Data JPA. Thus, please open an issue in their issue tracker.

@jhoeller jhoeller closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2025
@jhoeller jhoeller added for: external-project Needs a fix in external project and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project Needs a fix in external project
Projects
None yet
Development

No branches or pull requests

3 participants