JDAL Core Library
Introducction
JDAL Core simplifies database access operations, providing generic Database Acces Objects for Hibernate, JPA and iBatis
The PageableDataSource interface defines a contract for getting entities (from database) by pages.
The Page object contains the information for the page request (page number and size, the property used to order the results, order type and filter) as well as the query results (entity list, and total results).
So, the library is in charge of all the paging stuff, making the task of getting paged results on the server simple and intuitive: All you need to do is creating a Page object and make the request to the suitable PageableDataSource implementation. Moreover, the Page object itself implements the Paginator interface in order to navigate across the results pages.
Dao<Book> dao = new HibernateDao<Book>(Book.class); // Should use DI Page<Book> page = new Page(pageSize); dao.getPage(page); // Now that the first data is loaded, we can use page directly as Paginator page.first(); for (Book book : page.getData()) { // do something with books... } page.next(); // and so on ...