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 `SqlPaginatedQuery` class provides a robust and flexible mechanism for paginating results in a QueryDSL query. It abstracts the pagination logic into two generic interfaces —`Slice` and `Page`— which represent paginated results in different ways.
72
+
73
+
-`Page<U>`: A `Page` contains a list of results, total count of items, total number of pages, and a flag to indicate if there are more pages available.
74
+
-`Slice<U>`: A `Slice` contains a list of results and a flag to indicate if there are more items to be fetched, without calculating the total number of items or pages.
75
+
76
+
This allows you to manage and paginate large datasets efficiently when working with QueryDSL.
77
+
78
+
**Key Features**:
79
+
80
+
-**Pagination Logic**: Handles offset-based pagination by calculating the number of records to skip (`offset`) and the number of records to fetch (`limit`) using the page number and page size.
81
+
-**Sorting Support**: Allows dynamic sorting of query results by providing an `Expression` and an `Order` (ascending/descending).
82
+
-**Efficient Slicing**: Fetches a "slice" of data without loading the entire dataset, useful when you only need to know if there are more results to load (e.g., in infinite scroll scenarios).
83
+
-**Full Page Information**: Provides detailed information about the paginated dataset, including the total count, total pages, and whether there are more results.
84
+
85
+
**Working with Pagination from a WebService**:
86
+
87
+
First, you need to create a translation between the API sort key and a table column.
0 commit comments