I have case when i need unpaged result with sort order. So to implement this i just used Pageable.unpaged method that allows to pass Sort parameter and I am expacting that jpa repository will return unpaged but sorted result. But it is not working cause jpa repostiory ignores sorting for unpaged request:
@Override
public Page<T> findAll(Pageable pageable) {
if (pageable.isUnpaged()) {
return new PageImpl<>(findAll());
}
return findAll((Specification<T>) null, pageable);
}
Is it possible to change behavior to this:
@Override
public Page<T> findAll(Pageable pageable) {
if (pageable.isUnpaged()) {
if(pageable.getSort().isSorted()) {
return new PageImpl<>(findAll(pageable.getSort()));
}
return new PageImpl<>(findAll());
}
return findAll((Specification<T>) null, pageable);
}
I have case when i need unpaged result with sort order. So to implement this i just used Pageable.unpaged method that allows to pass Sort parameter and I am expacting that jpa repository will return unpaged but sorted result. But it is not working cause jpa repostiory ignores sorting for unpaged request:
Is it possible to change behavior to this: