Skip to content
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

Spring Data JPA generates incorrect JPQL query for sorted pagination request with UNION clause #3427

Open
Pedroloma opened this issue Apr 15, 2024 · 1 comment · May be fixed by #3429
Open
Assignees
Labels
type: bug A general bug

Comments

@Pedroloma
Copy link

Pedroloma commented Apr 15, 2024

After updating my app from 3.0.8 to 3.1.10, I get an exception for a JPL with UNION clauses, when the query is pageable and sorted.

I've created a GitHub repo where you can reproduce the issue: https://github.com/Pedroloma/JpaWithUnionAndPageableAndSortedApplication

I think, that this issue could be related to this other one: #2969

This is the exception thrown and its stack trace:

Caused by: org.hibernate.query.sqm.ParsingException: line 1:79 mismatched input 'ascUNION' expecting {<EOF>, ',', '.', '[', '+', '-', '*', '/', '%', '||', ASC, BY, DAY, DESC, EPOCH, FETCH, HOUR, LIMIT, MINUTE, MONTH, NANOSECOND, NULLS, OFFSET, QUARTER, SECOND, WEEK, YEAR}
	at org.hibernate.query.hql.internal.StandardHqlTranslator$1.syntaxError(StandardHqlTranslator.java:46)
	at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
	at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:543)
	at org.antlr.v4.runtime.DefaultErrorStrategy.reportInputMismatch(DefaultErrorStrategy.java:327)
	at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:139)
	at org.hibernate.grammars.hql.HqlParser.statement(HqlParser.java:361)
	at org.hibernate.query.hql.internal.StandardHqlTranslator.parseHql(StandardHqlTranslator.java:127)
	at org.hibernate.query.hql.internal.StandardHqlTranslator.translate(StandardHqlTranslator.java:77)
	at org.hibernate.query.internal.QueryInterpretationCacheStandardImpl.createHqlInterpretation(QueryInterpretationCacheStandardImpl.java:165)
	at org.hibernate.query.internal.QueryInterpretationCacheStandardImpl.resolveHqlInterpretation(QueryInterpretationCacheStandardImpl.java:147)
	at org.hibernate.internal.AbstractSharedSessionContract.interpretHql(AbstractSharedSessionContract.java:741)
	at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:786)
	... 212 common frames omitted

Please, let me know if you guys need some extra information.

Thanks in advance.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 15, 2024
@christophstrobl christophstrobl self-assigned this Apr 16, 2024
@christophstrobl
Copy link
Member

@Pedroloma thanks for reporting, we'll look into this.

@christophstrobl christophstrobl added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 16, 2024
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

Successfully merging a pull request may close this issue.

3 participants