Skip to content

Commit

Permalink
fixed overriding deprecated method on no count repository (eclipse-ha…
Browse files Browse the repository at this point in the history
…wkbit#1032)

Signed-off-by: Bogdan Bondar <[email protected]>
  • Loading branch information
bogdan-bondar authored and krishna-devolo committed Sep 23, 2021
1 parent e3f3ef1 commit 90dd139
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.support.SimpleJpaRepository;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Repository;

/**
Expand Down Expand Up @@ -102,11 +103,12 @@ public SimpleJpaNoCountRepository(final Class<T> domainClass, final EntityManage
}

@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.setMaxResults(pageable.getPageSize());

final List<T> content = query.getResultList();
final List<S> content = query.getResultList();

return new PageImpl<>(content, pageable, content.size());
}
Expand Down

0 comments on commit 90dd139

Please sign in to comment.