You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The intend of WindowIterator is to support users who need to iterate multiple windows. It keeps track of the position and loads the next window if needed so that the user does not have to interact with the position at all.
Also remove the Window methods to get the first/last position and enforce the index based variant.
Update the documentation to make use of the newly introduced API.
See: #2151
Original Pull Request: #2787
Copy file name to clipboardExpand all lines: src/main/asciidoc/repositories-scrolling.adoc
+46-27
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,36 @@ Scrolling consists of a stable sort, a scroll type (Offset- or Keyset-based scro
6
6
You can define simple sorting expressions by using property names and define static result limiting using the <<repositories.limit-query-result,`Top` or `First` keyword>> through query derivation.
7
7
You can concatenate expressions to collect multiple criteria into one expression.
8
8
9
-
Scroll queries return a `Scroll<T>` that allows obtaining the scroll position to resume to obtain the next `Scroll<T>` until your application has consumed the entire query result.
10
-
Similar to consuming a Java `Iterator<List<…>>` by obtaining the next batch of results, query result scrolling lets you access the next `ScrollPosition` through `Scroll.lastScrollPosition()`.
9
+
Scroll queries return a `Window<T>` that allows obtaining the scroll position to resume to obtain the next `Window<T>` until your application has consumed the entire query result.
10
+
Similar to consuming a Java `Iterator<List<…>>` by obtaining the next batch of results, query result scrolling lets you access the a `ScrollPosition` through `Window.positionAt(...)`.
`WindowIterator` provides a specialized implementation that simplifies consumption of multiple `Window` instances by removing the need to check for the presence of a next `Window` and applying the `ScrollPosition`.
@@ -50,31 +70,30 @@ This approach maintains a set of keys to resume scrolling by passing keys into t
50
70
51
71
The core idea of Keyset-Filtering is to start retrieving results using a stable sorting order.
52
72
Once you want to scroll to the next chunk, you obtain a `ScrollPosition` that is used to reconstruct the position within the sorted result.
53
-
The `ScrollPosition` captures the keyset of the last entity within the current `Scroll`.
73
+
The `ScrollPosition` captures the keyset of the last entity within the current `Window`.
54
74
To run the query, reconstruction rewrites the criteria clause to include all sort fields and the primary key so that the database can leverage potential indexes to run the query.
55
75
The database needs only constructing a much smaller result from the given keyset position without the need to fully materialize a large result and then skipping results until reaching a particular offset.
56
76
77
+
[WARNING]
78
+
====
79
+
Keyset-Filtering requires properties used for sorting to be non nullable.
80
+
This limitation applies due to the store specific `null` value handling of comparison operators as well as the need to run queries against an indexed source.
81
+
Keyset-Filtering on nullable properties will lead to unexpected results.
82
+
====
83
+
57
84
.Using `KeysetScrollPosition` with Repository Query Methods
0 commit comments