-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add support for Keyset- and Offset-based cursor scrolling #4317
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
Queries that either sort by or project on synthetic fields, such as |
|
||
@Override | ||
// TODO: CursorRequest and Query declare both a Sort. Which one has precedence? | ||
// CursorRequest is similar to Pageable in the sense of being required to define a sort order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That we have to ask ourselves this is an indicator that maybe the request should not be allowed to redefine sorting.
KeySetCursorQuery keysetPaginationQuery = CursorUtils.createKeysetPaginationQuery(query, keyset, | ||
operations.getIdPropertyName(sourceClass)); | ||
|
||
List<T> result = doFind(collectionName, createDelegate(query), keysetPaginationQuery.query(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're ignoring the targetClass
here. Might be worth to call doFind(createDelegate(query), collectionName, keysetPaginationQuery.query(), keysetPaginationQuery.fields(), sourceClass, targetClass, new QueryCursorPreparer(query, keysetPaginationQuery.sort(), limit, 0, sourceClass));
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targetClass
is considered in ReadDocumentCallback
. We might want to switch to ProjectingReadCallback
though. Same for the imperative template.
field projections using expressions work fine since those cannot be used for sorting. q.fields().project(valueOf("firstName").length()).as("nameLength").include("firstName", "age"); |
We now support scrolling through large query results using ScrollPosition and Window's of data.
Follow the changes in data commons that renamed scroll to window. Also error when a certain scroll position does not allow creating a query out of it because of null values.
Along the lines fix entity operations proxy handling by reading the underlying map instead of inspecting the proxy interface. Also make sure to map potential raw fields back to the according property.
Usage examples:
Repository query methods
Template API
Tasks:
Sort
precedence and limit/skip relationship toCursorRequest
for methods acceptingQuery
andCursorRequest
typesLimitations:
Closes #4308
Depends on spring-projects/spring-data-commons#2787