I am trying Spring data JPA in my project. I want to know if there is an out-of-the-box API to query data, by both Sort and Pageable. Of course, I
Sort
Pageable
in 2020, the accepted answer is kinda out of date since the PageRequest is deprecated, so you should use code like this :
PageRequest
Pageable page = PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by("id").descending()); return repository.findAll(page);