Class AbstractSqlPagingQueryProvider
java.lang.Object
org.springframework.cloud.task.repository.database.support.AbstractSqlPagingQueryProvider
- All Implemented Interfaces:
PagingQueryProvider
- Direct Known Subclasses:
Db2PagingQueryProvider,H2PagingQueryProvider,HsqlPagingQueryProvider,MariaDbPagingQueryProvider,MySqlPagingQueryProvider,OraclePagingQueryProvider,PostgresPagingQueryProvider,SqlServerPagingQueryProvider
Abstract SQL Paging Query Provider to serve as a base class for all provided SQL paging
query providers.
Any implementation must provide a way to specify the select clause, from clause and
optionally a where clause. It is recommended that there should be an index for the sort
key to provide better performance.
Provides properties and preparation for the mandatory "selectClause" and "fromClause"
as well as for the optional "whereClause".
- Author:
- Glenn Renfro
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringintThe number of parameters that are declared in the query.protected StringA Map<String, Order> of sort columns as the key andOrderfor ascending/descending.protected Stringvoidinit(DataSource dataSource) Initialize the query provider using the providedDataSourceif necessary.booleanIndicate whether the generated queries use named parameter syntax.voidsetFromClause(String fromClause) voidsetSelectClause(String selectClause) voidsetSortKeys(Map<String, org.springframework.batch.item.database.Order> sortKeys) voidsetWhereClause(String whereClause) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.cloud.task.repository.database.PagingQueryProvider
getPageQuery
-
Constructor Details
-
AbstractSqlPagingQueryProvider
public AbstractSqlPagingQueryProvider()
-
-
Method Details
-
getSelectClause
- Returns:
- SQL SELECT clause part of SQL query string
-
setSelectClause
- Parameters:
selectClause- SELECT clause part of SQL query string
-
getFromClause
- Returns:
- SQL FROM clause part of SQL query string
-
setFromClause
- Parameters:
fromClause- FROM clause part of SQL query string
-
getWhereClause
- Returns:
- SQL WHERE clause part of SQL query string
-
setWhereClause
- Parameters:
whereClause- WHERE clause part of SQL query string
-
getSortKeys
A Map<String, Order> of sort columns as the key andOrderfor ascending/descending.- Specified by:
getSortKeysin interfacePagingQueryProvider- Returns:
- sortKey key to use to sort and limit page content
-
setSortKeys
- Parameters:
sortKeys- key to use to sort and limit page content
-
getParameterCount
public int getParameterCount()Description copied from interface:PagingQueryProviderThe number of parameters that are declared in the query.- Specified by:
getParameterCountin interfacePagingQueryProvider- Returns:
- number of parameters
-
isUsingNamedParameters
public boolean isUsingNamedParameters()Description copied from interface:PagingQueryProviderIndicate whether the generated queries use named parameter syntax.- Specified by:
isUsingNamedParametersin interfacePagingQueryProvider- Returns:
- true if named parameter syntax is used
-
init
Description copied from interface:PagingQueryProviderInitialize the query provider using the providedDataSourceif necessary.- Specified by:
initin interfacePagingQueryProvider- Parameters:
dataSource- DataSource to use for any initialization- Throws:
Exception- throwsExceptionif query provider initialize fails.
-