-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Count query derivation from DISTINCT queries seems to be broken #3269
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
Comments
Thanks for reporting, sounds like you already have a test that you could share to help us diagnose the issue. Would you mind taking the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem? |
Sure: https://github.com/da-z/spring-data-jpa-issue-3269 (just run the test) |
I'm having the same problem here. |
We're working on a solution. Early snapshots (branch builds) should be available soon. |
Hello. Will this fix be merged into main? |
I have the same problem and i could it solve by using a dedicated |
@THD-Thomas-Lang The regression has already been fixed. All we need is more upvoters for this PR to be merged: #3276 |
Didn´t know that there is an upvote function? Thank you! |
There is no upvote function but you can leave a comment or react to one of the existing comments. Thanks! |
I have a large chunk of JPA code that was working fine in Spring Boot 2.x but not in Spring Boot 3.x (Hibernate 6 on Oracle and H2 in Oracle mode in tests):
Sample JPQL query:
In SB 3.x I am getting the error:
At 1:n and token 'AS', no viable alternative at input 'SELECT count(DISTINCT abc *AS x
And indeed, that's not a valid SQL query because aliases are not allowed in that scenario.
My take on this is: either strip the alias, or derive the Count query like this, which means you don't need to mess with the original query:
The text was updated successfully, but these errors were encountered: