public abstract class AbstractSqlPagingQueryProvider extends Object implements PagingQueryProvider
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".
Constructor and Description |
---|
AbstractSqlPagingQueryProvider() |
Modifier and Type | Method and Description |
---|---|
protected String |
getFromClause() |
int |
getParameterCount()
The number of parameters that are declared in the query
|
protected String |
getSelectClause() |
Map<String,Order> |
getSortKeys()
A Map<String, Order> of sort columns as the key and
Order for
ascending/descending. |
protected String |
getWhereClause() |
void |
init(DataSource dataSource)
Initialize the query provider using the provided
DataSource if necessary. |
boolean |
isUsingNamedParameters()
Indicate whether the generated queries use named parameter syntax.
|
void |
setFromClause(String fromClause) |
void |
setSelectClause(String selectClause) |
void |
setSortKeys(Map<String,Order> sortKeys) |
void |
setWhereClause(String whereClause) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPageQuery
protected String getSelectClause()
public void setSelectClause(String selectClause)
selectClause
- SELECT clause part of SQL query stringprotected String getFromClause()
public void setFromClause(String fromClause)
fromClause
- FROM clause part of SQL query stringprotected String getWhereClause()
public void setWhereClause(String whereClause)
whereClause
- WHERE clause part of SQL query stringpublic Map<String,Order> getSortKeys()
Order
for
ascending/descending.getSortKeys
in interface PagingQueryProvider
public void setSortKeys(Map<String,Order> sortKeys)
sortKeys
- key to use to sort and limit page contentpublic int getParameterCount()
PagingQueryProvider
getParameterCount
in interface PagingQueryProvider
public boolean isUsingNamedParameters()
PagingQueryProvider
isUsingNamedParameters
in interface PagingQueryProvider
public void init(DataSource dataSource) throws Exception
PagingQueryProvider
DataSource
if necessary.init
in interface PagingQueryProvider
dataSource
- DataSource to use for any initializationException
- if can't create the SQL for a paging query clauseCopyright © 2020 Pivotal Software, Inc.. All rights reserved.