fixed overriding deprecated method on no count repository (#1032)
Signed-off-by: Bogdan Bondar <Bogdan.Bondar@bosch.io>
This commit is contained in:
@@ -23,6 +23,7 @@ import org.springframework.data.domain.Slice;
|
|||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
|
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
|
||||||
|
import org.springframework.lang.Nullable;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,11 +103,12 @@ public class NoCountPagingRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Page<T> readPage(final TypedQuery<T> query, final Pageable pageable, final Specification<T> spec) {
|
protected <S extends T> Page<S> readPage(final TypedQuery<S> query, final Class<S> domainClass,
|
||||||
|
final Pageable pageable, @Nullable final Specification<S> spec) {
|
||||||
query.setFirstResult((int) pageable.getOffset());
|
query.setFirstResult((int) pageable.getOffset());
|
||||||
query.setMaxResults(pageable.getPageSize());
|
query.setMaxResults(pageable.getPageSize());
|
||||||
|
|
||||||
final List<T> content = query.getResultList();
|
final List<S> content = query.getResultList();
|
||||||
|
|
||||||
return new PageImpl<>(content, pageable, content.size());
|
return new PageImpl<>(content, pageable, content.size());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user