-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add the possibility to fetch using Specification and Pageable but without doing a count query #2762
Comments
We could enhance the |
could anybody tell me that has this problem solved or how could I realize this feature? |
We also tried and searched everything to use Specifiactions along with a sql limit. Unfortunatley no method seems to offer us this usecase.
Note that |
yeah, finally, I also ended up with a custom repository method implemention.
|
Please also cover this for |
This is escaping some records in the result set |
Any updates on this? Thanks. |
If you use MySQL (other DBs might have it as well), your second query could be a super cheap one: Hope this helps. |
@ Spring-Team: could the |
Fixed via #3727 |
If you use
Page<T> findAll(Pageable pageable)
then Spring Data will execute the select plus the count query for every call. To get rid of the count query when you do not need the total count, you can add a find by without any filters:List<T> findBy(Pageable pageable)
. You cannot add aList<T> findAll(Pageable pageable)
as it will conflict withfindAll
that returns aPage<T>
.However when you use a
Specification
for filtering you still would want the same possibility: to get rid of the count query.The available findAll is
Page<T> findAll(Specification<T> spec, Pageable pageable)
which again prevents adding aList<T> findAll(Specification<T> spec, Pageable pageable)
. Also it seems that thefindBy
"hack" cannot be used as a method likeList<T> findBy(Specification<T> filter, Pageable pageable);
will throwIs there another way to accomplish this or could it be added as a feature?
The text was updated successfully, but these errors were encountered: