-
Book Overview & Buying
-
Table Of Contents
Spring Data
By :
Paginating query results is a very common requirement for practically every application that presents some kind of data. The key component of the pagination support of Spring Data JPA is the Pageable interface that declares the following methods:
|
Method |
Description |
|---|---|
|
|
Returns the number of the requested page. The page numbers are zero indexed. Thus, the number of the first page is zero. |
|
|
Returns the number of elements shown on a single page. The page size must always be larger than zero. |
|
|
Returns the selected offset according to the given page number and page size. |
|
|
Returns the sorting parameters used to sort the query results. |
We can use this interface to paginate the query results with Spring Data JPA by:
Creating a new PageRequest object. We can use the PageRequest class because it implements the Pageable interface.
Passing the created object to a repository method as a parameter.
If...
Change the font size
Change margin width
Change background colour