From d3a56e668bc2f87ef62b671a9e78d9c36a5b0152 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 e417be1bc..2620d9ff4 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 @@ -454,9 +454,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: @@ -464,6 +465,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();