Pagination

Pagination returns results in pages rather than all at once. With Spring Data, you pass a Pageable (PageRequest.of(page, size, sort)) to the repository, which returns a Page<T> containing the elements, the total count, and the number of pages. Pages start at 0, and the order must be defined for stable results.

Example

Page<Client> p = repo.findAll(PageRequest.of(0, 20, Sort.by("nom")));

Related concepts

The whole glossary