In my case, to use Pageable
and Sorting
at the same time I used like below. In this case I took all elements using pagination and sorting by id
by descending order:
modelRepository.findAll(PageRequest.of(page, 10, Sort.by("id").descending()))
Like above based on your requirements you can sort data with 2 columns as well.