From d470c9887768d3bf956e77e0fc9b2a9c67262c89 Mon Sep 17 00:00:00 2001 From: Christoph Strobl Date: Thu, 14 Dec 2023 15:55:53 +0100 Subject: [PATCH] Add `Limit` parameter to section in reference documentation. Closes #3006 Original pull request: #3007 --- .../ROOT/pages/repositories/query-methods-details.adoc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/antora/modules/ROOT/pages/repositories/query-methods-details.adoc b/src/main/antora/modules/ROOT/pages/repositories/query-methods-details.adoc index ea2fddb1b..3ab79bafc 100644 --- a/src/main/antora/modules/ROOT/pages/repositories/query-methods-details.adoc +++ b/src/main/antora/modules/ROOT/pages/repositories/query-methods-details.adoc @@ -481,9 +481,10 @@ ifdef::feature-scroll[] endif::[] [[repositories.limit-query-result]] -== Limiting Query Results +=== Limiting Query Results -You can limit the results of query methods by using the `first` or `top` keywords, which you can use interchangeably. +In addition to paging it is possible to limit the result size using a dedicated `Limit` parameter. +You can also limit the results of query methods by using the `first` or `top` keywords, which you can use interchangeably but may not be mixed with a `Limit` parameter. You can append an optional numeric value to `top` or `first` to specify the maximum result size to be returned. If the number is left out, a result size of 1 is assumed. The following example shows how to limit the query size: @@ -491,6 +492,8 @@ The following example shows how to limit the query size: .Limiting the result size of a query with `Top` and `First` [source,java] ---- +List findByLastname(Limit limit); + User findFirstByOrderByLastnameAsc(); User findTopByOrderByAgeDesc();