-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Using native Query with distinct is returning wrong total count #2177
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
The `COUNT_MATCH` did not consider line breaks after the `from` clause or the `where` clause. This lead to a no match scenario in the construction of the count query. With the fix we now consider line breaks/whitespaces after the `from` and `where` clause. Closes spring-projects#2341 Related tickets spring-projects#2177
Looks like changes leads to the following: #2260 (comment) |
I found out that this commit has bug: 3e64d9a Especially, the line 494: The invocation of method
returns However, if we change the query to |
Commits and tests marked with issue #2341 |
In commit 3e64d9a a bug got introduced that uses the next symbol after the table name for the count function. With this commit this should be now resolved. The count query will use `*` when there is no alias present nor a variable. Related tickets spring-projects#2177, spring-projects#2260, spring-projects#2511
@DiegoKrupitza Thank you! |
Hello, It seems that Hibernate is removing the "distinct" key word from the native Query when using the count to get the total elements.
Any Workaround for this?
Springboot 2.3.7
A fragment for the logs:
The log for the get entities
The log for the count query generated by hibernate (as you can see, for some reason, it is removing the "distinct" keyword)
This seems like bug for me. I saw this issue from a long ago time but without any solution (a part from generating my own count query) #750
The text was updated successfully, but these errors were encountered: