Interface PagingQueryProvider
- All Known Implementing Classes:
AbstractSqlPagingQueryProvider
,Db2PagingQueryProvider
,DerbyPagingQueryProvider
,H2PagingQueryProvider
,HanaPagingQueryProvider
,HsqlPagingQueryProvider
,MySqlPagingQueryProvider
,OraclePagingQueryProvider
,PostgresPagingQueryProvider
,SqlitePagingQueryProvider
,SqlServerPagingQueryProvider
,SqlWindowingPagingQueryProvider
,SybasePagingQueryProvider
public interface PagingQueryProvider
Interface defining the functionality to be provided for generating paging queries for use with Paging
Item Readers.
- Since:
- 2.0
- Author:
- Thomas Risberg, Michael Minella
-
Method Summary
Modifier and TypeMethodDescriptiongenerateFirstPageQuery
(int pageSize) Generate the query that will provide the first page, limited by the page size.generateJumpToItemQuery
(int itemIndex, int pageSize) Generate the query that will provide the jump to item query.generateRemainingPagesQuery
(int pageSize) Generate the query that will provide the first page, limited by the page size.int
The number of parameters that are declared in the querygetSortKeyPlaceHolder
(String keyName) Returns either a String to be used as the named placeholder for a sort key value (based on the column name) or a ? for unnamed parameters.The sort keys.The sort key (unique single column name) without alias.void
init
(DataSource dataSource) Initialize the query provider using the providedDataSource
if necessary.boolean
Indicate whether the generated queries use named parameter syntax.
-
Method Details
-
init
Initialize the query provider using the providedDataSource
if necessary.- Parameters:
dataSource
- DataSource to use for any initialization- Throws:
Exception
- for errors when initializing
-
generateFirstPageQuery
Generate the query that will provide the first page, limited by the page size.- Parameters:
pageSize
- number of rows to read for each page- Returns:
- the generated query
-
generateRemainingPagesQuery
Generate the query that will provide the first page, limited by the page size.- Parameters:
pageSize
- number of rows to read for each page- Returns:
- the generated query
-
generateJumpToItemQuery
Generate the query that will provide the jump to item query. The itemIndex provided could be in the middle of the page and together with the page size it will be used to calculate the last index of the preceding page to be able to retrieve the sort key for this row.- Parameters:
itemIndex
- the index for the next item to be readpageSize
- number of rows to read for each page- Returns:
- the generated query
-
getParameterCount
int getParameterCount()The number of parameters that are declared in the query- Returns:
- number of parameters
-
isUsingNamedParameters
boolean isUsingNamedParameters()Indicate whether the generated queries use named parameter syntax.- Returns:
- true if named parameter syntax is used
-
getSortKeys
The sort keys. A Map of the columns that make up the key and a Boolean indicating ascending or descending (ascending = true).- Returns:
- the sort keys used to order the query
-
getSortKeyPlaceHolder
Returns either a String to be used as the named placeholder for a sort key value (based on the column name) or a ? for unnamed parameters.- Parameters:
keyName
- The sort key name- Returns:
- The string to be used for a parameterized query.
-
getSortKeysWithoutAliases
The sort key (unique single column name) without alias.- Returns:
- the sort key used to order the query (without alias)
-