Skip to content

Add Limit parameter to section in reference documentation. #3007

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>3.3.0-SNAPSHOT</version>
<version>3.3.x-3006-SNAPSHOT</version>

<name>Spring Data Core</name>
<description>Core Spring concepts underpinning every Spring Data module.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,16 +481,19 @@ 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:

.Limiting the result size of a query with `Top` and `First`
[source,java]
----
List<User> findByLastname(Limit limit);

User findFirstByOrderByLastnameAsc();

User findTopByOrderByAgeDesc();
Expand Down