Class AbstractSqlPagingQueryProvider

All Implemented Interfaces:
Direct Known Subclasses:
Db2PagingQueryProvider, H2PagingQueryProvider, HsqlPagingQueryProvider, MariaDbPagingQueryProvider, MySqlPagingQueryProvider, OraclePagingQueryProvider, PostgresPagingQueryProvider, SqlServerPagingQueryProvider

public abstract class AbstractSqlPagingQueryProvider extends Object implements PagingQueryProvider
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".
Glenn Renfro
  • Constructor Details

    • AbstractSqlPagingQueryProvider

      public AbstractSqlPagingQueryProvider()
  • Method Details

    • getSelectClause

      protected String getSelectClause()
      SQL SELECT clause part of SQL query string
    • setSelectClause

      public void setSelectClause(String selectClause)
      selectClause - SELECT clause part of SQL query string
    • getFromClause

      protected String getFromClause()
      SQL FROM clause part of SQL query string
    • setFromClause

      public void setFromClause(String fromClause)
      fromClause - FROM clause part of SQL query string
    • getWhereClause

      protected String getWhereClause()
      SQL WHERE clause part of SQL query string
    • setWhereClause

      public void setWhereClause(String whereClause)
      whereClause - WHERE clause part of SQL query string
    • getSortKeys

      public Map<String,org.springframework.batch.item.database.Order> getSortKeys()
      A Map<String, Order> of sort columns as the key and Order for ascending/descending.
      Specified by:
      getSortKeys in interface PagingQueryProvider
      sortKey key to use to sort and limit page content
    • setSortKeys

      public void setSortKeys(Map<String,org.springframework.batch.item.database.Order> sortKeys)
      sortKeys - key to use to sort and limit page content
    • getParameterCount

      public int getParameterCount()
      Description copied from interface: PagingQueryProvider
      The number of parameters that are declared in the query.
      Specified by:
      getParameterCount in interface PagingQueryProvider
      number of parameters
    • isUsingNamedParameters

      public boolean isUsingNamedParameters()
      Description copied from interface: PagingQueryProvider
      Indicate whether the generated queries use named parameter syntax.
      Specified by:
      isUsingNamedParameters in interface PagingQueryProvider
      true if named parameter syntax is used
    • init

      public void init(DataSource dataSource) throws Exception
      Description copied from interface: PagingQueryProvider
      Initialize the query provider using the provided DataSource if necessary.
      Specified by:
      init in interface PagingQueryProvider
      dataSource - DataSource to use for any initialization
      Exception - throws Exception if query provider initialize fails.