PagingAndSortingRepository findAll

TheSpring Data Jpa PagingAndSortingRepository interface extends the base CrudRepository and implemented in the SimpleJpaRepository interface provides the method to find all the records of the underlying database in the sorted order provided.

the CrudRepository interface provides the findAll method, which is used to find all the records of entity type provided in the underlying database. but the CrudRepository#findAll method has no sorting or pagination option available. Result returned by CrudRepository#findAll doesn't guarantee any order.

The PagingAndSortingRepository provides an overloaded findAll method, which retrives results in sorted by using Sort and pagination output using Pageable as parameter.

  • findAll(Sort sort)
  • findAll(Pageable pageable)

follow us on