From a832cd1e4739a1da0adaa454f9c5524eb218db79 Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Thu, 3 Feb 2011 15:03:36 +0000 Subject: [PATCH] Added documentation for PagingAndSortingRepository. --- src/docbkx/repositories.xml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/docbkx/repositories.xml b/src/docbkx/repositories.xml index ea0a26021..8c5d51fa3 100644 --- a/src/docbkx/repositories.xml +++ b/src/docbkx/repositories.xml @@ -107,6 +107,27 @@ to include additional technology specific methods. We will now ship implementations for a variety of Spring Data modules that implement that interface. + + On top of the Repository there is a PagingAndSortingRepository + abstraction that adds additional methods to ease paginated access to + entities: + + + PagingAndSortingRepository + + public interface PagingAndSortingRepository<T, ID extends Serializable> extends Repository<T, ID> { + + List<T> findAll(Sort sort); + + Page<T> findAll(Pageable pageable); +} + + + Accessing the second page of User by a page size of 20 you could + simply do something like this: + + PagingAndSortingRepository<User, Long> repository = // … get access to a bean +Page<User> users = repository.findAll(new PageRequest(1, 20);
@@ -385,7 +406,7 @@ List<User> findByLastname(String lastname, Pageable pageable);UserRepository would be registered under userRepository. The base-package attribute allows to use wildcards, so that you can have a pattern of - packages parsed. + packages parsed. Using filters