From 1ea8d09b38ddf8c0870806e87e0c0572c6960b2b Mon Sep 17 00:00:00 2001 From: Diego Krupitza Date: Tue, 15 Mar 2022 15:33:23 +0100 Subject: [PATCH] Update documentation for repository `Pageable` and `Sort` arguments. Replace outdated `null` acceptance for `Pageable` with `Pageable.unpaged()` `QueryByExampleExecutor#findAll(Example example, Pageable pageable)` should does not accept null values since there is `Pageable.unpaged()`. Furthermore, the same applies to `PagingAndSortingRepository#findAll(Pageable pageable)`. Related ticket: spring-projects/spring-data-jpa/issues/2464 Closes #2574 --- .../data/repository/PagingAndSortingRepository.java | 2 +- .../data/repository/query/QueryByExampleExecutor.java | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/springframework/data/repository/PagingAndSortingRepository.java b/src/main/java/org/springframework/data/repository/PagingAndSortingRepository.java index f187b1eeb..3c6eff5af 100644 --- a/src/main/java/org/springframework/data/repository/PagingAndSortingRepository.java +++ b/src/main/java/org/springframework/data/repository/PagingAndSortingRepository.java @@ -45,7 +45,7 @@ public interface PagingAndSortingRepository extends Repository { /** * Returns a {@link Page} of entities meeting the paging restriction provided in the {@code Pageable} object. * - * @param pageable + * @param pageable must not be {@literal null}. * @return a page of entities */ Page findAll(Pageable pageable); diff --git a/src/main/java/org/springframework/data/repository/query/QueryByExampleExecutor.java b/src/main/java/org/springframework/data/repository/query/QueryByExampleExecutor.java index 04dfaf231..664f6e9fd 100644 --- a/src/main/java/org/springframework/data/repository/query/QueryByExampleExecutor.java +++ b/src/main/java/org/springframework/data/repository/query/QueryByExampleExecutor.java @@ -29,6 +29,7 @@ import org.springframework.data.domain.Sort; * @param * @author Mark Paluch * @author Christoph Strobl + * @author Diego Krupitza * @since 1.12 * @see ListQueryByExampleExecutor */ @@ -68,7 +69,7 @@ public interface QueryByExampleExecutor { * {@link Page} is returned. * * @param example must not be {@literal null}. - * @param pageable can be {@literal null}. + * @param pageable must not be {@literal null}. * @return a {@link Page} of entities matching the given {@link Example}. */ Page findAll(Example example, Pageable pageable);