Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are using ORM , <a href="http://www.springsource.org/spring-data/jpa">Spring Data JPA</a>, can easily provide out-of-the box pagination feature.</p> <p>DAO interface for entity that needs pagination will extend <a href="http://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/repository/PagingAndSortingRepository.html">PagingAndSortingRepository</a> interface like:-</p> <pre><code>public interface BookRepository extends PagingAndSortingRepository&lt;Book,Long&gt;{ // methods other than plain CRUD can be declared here } </code></pre> <p>The key interface for pagination operation is <a href="http://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/Pageable.html">Pageable</a>. Its ready to use implementation <a href="http://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/PageRequest.html">PageRequest</a> encapsulates pagination inputs like max result size, page no, size, sort by, sort direction, offset.</p> <p>PageRequest can be fetched from request attribute in a handler method and passed as an argument to the repository method like:-</p> <pre><code>Page&lt;Book&gt; result = bookRepository.findAll(pageRequest); </code></pre> <p>The return type <a href="http://docs.spring.io/spring-data/commons/docs/current/api/org/springframework/data/domain/Page.html">Page</a> , can be easily iterated in view layer to render details like result size, total no of results, sort order, sort direction.</p> <p>I found this <a href="http://www.petrikainulainen.net/programming/spring-framework/spring-data-jpa-tutorial-part-seven-pagination/">tutorial</a> helpful.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload