Pagination Object
Hint
This article is generated by AI translation.
dbVisitor ships with PageObject, an implementation of the Page interface that exposes handy pagination properties and methods.
| Name | Description |
|---|---|
Attribute pageSize | Page size; default -1 means unlimited |
Attribute currentPage | Current page number |
Attribute pageNumberOffset | Page-number offset (set to 1 if your first page is 1, otherwise page 0 is the first page) |
Method long getFirstRecordPosition() | Index of the first record on the current page |
Method long getTotalPage() | Total number of pages |
Method long getTotalCount() | Total number of records |
Method long firstPage() | Jump to the first page |
Method void previousPage() | Move to the previous page |
Method void nextPage() | Move to the next page |
Method void lastPage() | Jump to the last page |
Method Map<String, Object> toPageInfo() | Return pagination metadata as a map |
toPageInfo returns a Map like the following:
{
"enable" : true,
"pageSize" : 20,
"totalCount" : 200,
"totalPage" : 10,
"currentPage" : 0,
"recordPosition" : 0
}
Custom Dialects
Five interfaces shape dialect customizations, all extending SqlDialect:
SqlDialect: base interface for keywords, table/column names, and ORDER BY fragmentsConditionSqlDialect: condition helpers such asLIKEInsertSqlDialect: advanced INSERT generation (e.g., conflict handling)PageSqlDialect: pagination SQL generationSeqSqlDialect: sequence-related SQL
Tip
Extend AbstractDialect and implement PageSqlDialect to build your own pagination dialect.
countSql: generate the COUNT querypageSql: generate the paginated query
Register a custom dialect
SqlDialectRegister.registerDialectAlias(JdbcUtils.MYSQL, MyDialect.class);