spring-projects / spring-data-jpa

Simplifies the development of creating a JPA-based data access layer.
https://spring.io/projects/spring-data-jpa/
Apache License 2.0
2.92k stars 1.39k forks source link

Modify getQuery(Specification, Pageable) #3517

Open birariro opened 1 week ago

birariro commented 1 week ago

3476

This problem is not just happening with findAll(pageable pageable) also occur in findAll(Specification<T> spec, Pageable pageable)

How about fixing it like this?

@Override
public Page<T> findAll(Pageable pageable) {
    return findAll((Specification<T>) null, pageable);
}
protected TypedQuery<T> getQuery(@Nullable Specification<T> spec, Pageable pageable) {
    return getQuery(spec, getDomainClass(), pageable.getSort());
}