-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Use provider built-in result count to reuse query if possible #3456
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
Conversation
Hibernate introduce `SelectionQuery::getResultCount` since 6.5.0, It may be JPA Query method in the future.
Thank you @quaff for bringing this up. Did you eventually compare the resulting database interaction triggered by |
|
52ee55f
to
61e6d36
Compare
This PR isn't complete. I took a look at a complete implementation and pushed my variant on https://github.com/spring-projects/spring-data-jpa/tree/issue/3456. |
Using |
We now use Hibernate's built-in mechanism to obtain the result count if there is an enclosing transaction. Without the transaction, the session is being closed and we cannot run the query. Closes #3456
Thanks for the suggestion. We've implemented a variant via cdcac86. |
Hibernate introduce
SelectionQuery::getResultCount
since 6.5.0, It may be JPA Query method in the future.