The PagingAndSortingRepository defines methods that provide the functionality to divide the ResultSet into pages as well as sort the results:
public interface PagingAndSortingRepository<T, ID extends
Serializable>
extends CrudRepository<T, ID> {
Iterable<T> findAll(Sort sort);
Page<T> findAll(Pageable pageable);
}
We will look at examples of using the Sort class and Page, Pageable interfaces in the section on Spring Data JPA.