Skip to content

Hibernate duration literals such as "5 MINUTE" no longer pass validation #3025

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
tomas-c opened this issue Jun 14, 2023 · 1 comment
Closed
Assignees
Labels
in: query-parser Everything related to parsing JPQL or SQL type: regression A regression from a previous release

Comments

@tomas-c
Copy link

tomas-c commented Jun 14, 2023

  @Query("SELECT ce.id FROM CalendarEvent ce WHERE (ce.endDate - ce.startDate) > 5 MINUTE")
  fun test(): List<UUID>

fails with

org.springframework.data.jpa.repository.query.BadJpqlGrammarException: Line 1:73 extraneous input 'MINUTE' expecting <EOF>; Bad JPQL grammar [SELECT ce.id FROM CalendarEvent ce WHERE (ce.endDate - ce.startDate) > 5 MINUTE]
  at app//org.springframework.data.jpa.repository.query.BadJpqlGrammarErrorListener.syntaxError(BadJpqlGrammarErrorListener.java:39)
  at app//org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
  at app//org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:543)
  at app//org.antlr.v4.runtime.DefaultErrorStrategy.reportUnwantedToken(DefaultErrorStrategy.java:377)
  at app//org.antlr.v4.runtime.DefaultErrorStrategy.singleTokenDeletion(DefaultErrorStrategy.java:548)
  at app//org.antlr.v4.runtime.DefaultErrorStrategy.recoverInline(DefaultErrorStrategy.java:467)
  at app//org.antlr.v4.runtime.Parser.match(Parser.java:207)
  at app//org.springframework.data.jpa.repository.query.HqlParser.start(HqlParser.java:252)
  at app//org.springframework.data.jpa.repository.query.HqlQueryParser.parseQuery(HqlQueryParser.java:53)
  at app//org.springframework.data.jpa.repository.query.HqlQueryParser.parse(HqlQueryParser.java:63)
  at app//org.springframework.data.jpa.repository.query.JpaQueryParserSupport$ParseState.lambda$new$0(JpaQueryParserSupport.java:182)
  at app//org.springframework.data.util.Lazy.getNullable(Lazy.java:245)
  at app//org.springframework.data.util.Lazy.get(Lazy.java:114)
  at app//org.springframework.data.jpa.repository.query.JpaQueryParserSupport$ParseState.getContext(JpaQueryParserSupport.java:194)
  at app//org.springframework.data.jpa.repository.query.JpaQueryParserSupport.renderSortedQuery(JpaQueryParserSupport.java:54)

Used to work before updating to Spring Data JPA 3.1.0

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 14, 2023
@gregturn gregturn self-assigned this Jun 14, 2023
@gregturn gregturn added type: regression A regression from a previous release in: query-parser Everything related to parsing JPQL or SQL and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 14, 2023
@gregturn gregturn added this to the 3.1.1 (2023.0.1) milestone Jun 14, 2023
gregturn added a commit that referenced this issue Jun 14, 2023
Hibernate supports varisous duration literals. They also support a couple formats for binary literals.

See #3025
gregturn added a commit that referenced this issue Jun 14, 2023
Hibernate supports varisous duration literals. They also support a couple formats for binary literals.

See #3025
gregturn added a commit that referenced this issue Jun 14, 2023
Hibernate supports varisous duration literals. They also support a couple formats for binary literals.

See #3025
@gregturn
Copy link
Contributor

That's merged to main and backported to 3.1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: query-parser Everything related to parsing JPQL or SQL type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

3 participants