sormula | simple (easy) object relational mapping | |
|
Select a specific page Table<Book> table = ... try (PaginatedListSelector<Book> selector = new PaginatedListSelector<>(pageSize, table)) { selector.setWhere("top"); selector.setParameters(15); selector.setOrderByName("titleOrder"); selector.execute(); selector.setPageNumber(42); List<Book> pageBooks = selector.selectPage(); } Table<Book> table = ... try (PaginatedListSelector<Book> selector = new PaginatedListSelector<>(pageSize, table)) { selector.setWhere("top"); selector.setParameters(15); selector.setOrderByName("titleOrder"); selector.execute(); int pageNumber = 1; while (true) { selector.setPageNumber(pageNumber); List<Book> pageBooks = selector.selectPage(); if (pageBooks.isEmpty()) break; System.out.println("Page " + pageNumber); printAll(pageBooks); System.out.println(); ++pageNumber; } } |
|
© 2018 Sormula, LLC |