Pagination and Sorting
Let’s learn to enable pagination and sorting capabilities in the JPA repositories.
PagingAndSortingRepository
So far, we’ve integrated our REST APIs for CRUD operations with the database by using JPA,s TodoRepository and TodoTypeRepository repositories. We also extended the CrudRepository interface. In this lesson, we’ll replace the CrudRepository with the PagingAndSortingRepository to enable pagination and sorting features.
TodoRepository extending PagingAndSortingRepository
TodoTypeRepository extending PagingAndSortingRepository
Let’s look at the findAll methods of the PagingAndSortingRepository interface with the Sort and Pageable parameters:
public interface PagingAndSortingRepository<T, ID> extends CrudRepository<T, ID> ...