Closed as not planned
Closed as not planned
Description
Passing an unpaged Pageable containing a sorted Sort to the PagingAndSortingRepository.findAll(Pageable) method ignores the Pageable's Sort, generating an SQL SELECT statement that is missing the requisite ORDER BY clause. The following code fragment illustrates the problem:
List<Order> orders = List.of(Order.asc("sortProperty"));
Sort sort = Sort.by(orders);
Pageable pageable = Pageable.unpaged(sort);
ListPagingAndSortingRepository<T, ID> repository = ...;
Page<T> unsortedPage = repository.findAll(pageable);
List<T> sortedContent = repository.findAll(sort);
assert unsortedPage.getContent().equals(sortedContent) : "The findAll(Pageable) overload does not sort the content";