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
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/repositories/scrolling.adoc
+17-3
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ 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 xref:repositories/query-methods-details.adoc#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 `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.
9
+
Scroll queries return a `Window<T>` that allows obtaining the elements scroll position which can be used to fetch the next `Window<T>` until your application has consumed the entire query result.
10
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(...)`.
11
11
12
12
[source,java]
@@ -23,12 +23,19 @@ do {
23
23
} while (!users.isEmpty() && users.hasNext());
24
24
----
25
25
26
+
[NOTE]
27
+
====
28
+
The `ScrollPosition` identifies the exact position of an element with the entire query result.
29
+
Query execution treats the position parameter as _exclusive_, which means results will start _after_ the given position.
30
+
`ScrollPosition#offset` and `ScrollPosition#keyset()` as special incarnations of a `ScrollPosition` indicating the start of a scroll operation.
31
+
====
32
+
26
33
`WindowIterator` provides a utility to simplify scrolling across ``Window``s by removing the need to check for the presence of a next `Window` and applying the `ScrollPosition`.
<1> Start from the initial offset at position `0`.
66
+
<1> Start with no offset to include the element at position `0`.
67
+
====
68
+
69
+
[CAUTION]
70
+
====
71
+
There is a difference between `ScollPosition.offset()` and `ScollPosition.offset(0L)`.
72
+
The former indicates the start of scroll operation, pointing to no specific offset where as the latter identifies the first element (at position `0`) of the result.
73
+
Given the _exclusive_ nature of scrolling using `ScollPosition.offset(0)` will skip the first element and translate to an offset of 1.
0 commit comments