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

Keyset pagination in a repository interface #3806

Closed
yakom opened this issue Mar 9, 2025 · 1 comment
Closed

Keyset pagination in a repository interface #3806

yakom opened this issue Mar 9, 2025 · 1 comment
Labels
status: waiting-for-triage An issue we've not yet triaged

Comments

@yakom
Copy link

yakom commented Mar 9, 2025

hello,

i scoured the documentation and even used LLMs to search for an answer (sick!), but i found nothing.

the main point is - i'm trying to implement keyset pagination. is it possible to define such a repository interface method?

List<Entity> findAllBy(Specification<Entity> specification, Sort sort, Limit limit);

the where condition is in the specification, ordering and limiting need to go along. i don't want to use Pageable in order not to have the extra count query executed, since that defeats the point. and if it's true that Limit is converted to Pageable under the hood, then it's not the way to go anyway.

another option would be perhaps dynamic limit value, but from what i see it's not possible as well?

is there a way to implement proper keyset pagination with Spring Data that i don't see, aside from implementing a custom repository?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 9, 2025
@yakom yakom changed the title Keyset pagination in an Keyset pagination in a repository interface Mar 9, 2025
@yakom
Copy link
Author

yakom commented Mar 9, 2025

nevermind, found the callback-accepting findBy method.

@yakom yakom closed this as completed Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants