类 AbstractSqlPagingQueryProvider

  • 所有已实现的接口:
    PagingQueryProvider
    直接已知子类:
    H2PagingQueryProvider, HsqlPagingQueryProvider, MySqlPagingQueryProvider, OraclePagingQueryProvider, PostgresPagingQueryProvider, SqlitePagingQueryProvider, SqlWindowingPagingQueryProvider

    public abstract class AbstractSqlPagingQueryProvider
    extends java.lang.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. In addition a way to specify a single column sort key must also be provided. This sort key will be used to provide the paging functionality. 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". Also provides property for the mandatory "sortKeys". Note: The columns that make up the sort key must be a true key and not just a column to order by. It is important to have a unique key constraint on the sort key to guarantee that no data is lost between executions.
    从以下版本开始:
    2.0
    作者:
    Thomas Risberg, Dave Syer, Michael Minella, Mahmoud Ben Hassine, Benjamin Hetz
    • 方法概要

      所有方法 实例方法 抽象方法 具体方法 
      修饰符和类型方法说明
      abstract java.lang.StringgenerateFirstPageQuery​(int pageSize)
      Method generating the query string to be used for retrieving the first page.
      abstract java.lang.StringgenerateJumpToItemQuery​(int itemIndex, int pageSize)
      Method generating the query string to be used for jumping to a specific item position.
      abstract java.lang.StringgenerateRemainingPagesQuery​(int pageSize)
      Method generating the query string to be used for retrieving the pages following the first page.
      protected java.lang.StringgetFromClause() 
      java.lang.StringgetGroupClause()
      The getter for the group by clause
      intgetParameterCount()
      The number of parameters that are declared in the query
      protected java.lang.StringgetSelectClause() 
      java.lang.StringgetSortKeyPlaceHolder​(java.lang.String keyName)
      The sort key placeholder will vary depending on whether named parameters or traditional placeholders are used in query strings.
      java.util.Map<java.lang.String,​Order>getSortKeys()
      A Map<String, Boolean> of sort columns as the key and boolean for ascending/descending (ascending = true).
      java.util.Map<java.lang.String,​Order>getSortKeysWithoutAliases()
      The sort key (unique single column name) without alias.
      protected java.lang.StringgetWhereClause() 
      voidinit​(javax.sql.DataSource dataSource)
      Check mandatory properties.
      booleanisUsingNamedParameters()
      Indicate whether the generated queries use named parameter syntax.
      voidsetFromClause​(java.lang.String fromClause) 
      voidsetGroupClause​(java.lang.String groupClause)
      The setter for the group by clause
      voidsetSelectClause​(java.lang.String selectClause) 
      voidsetSortKeys​(java.util.Map<java.lang.String,​Order> sortKeys) 
      voidsetWhereClause​(java.lang.String whereClause) 
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 方法详细资料

      • setGroupClause

        public void setGroupClause​(java.lang.String groupClause)
        The setter for the group by clause
        参数:
        groupClause - SQL GROUP BY clause part of the SQL query string
      • getGroupClause

        public java.lang.String getGroupClause()
        The getter for the group by clause
        返回:
        SQL GROUP BY clause part of the SQL query string
      • setSelectClause

        public void setSelectClause​(java.lang.String selectClause)
        参数:
        selectClause - SELECT clause part of SQL query string
      • getSelectClause

        protected java.lang.String getSelectClause()
        返回:
        SQL SELECT clause part of SQL query string
      • setFromClause

        public void setFromClause​(java.lang.String fromClause)
        参数:
        fromClause - FROM clause part of SQL query string
      • getFromClause

        protected java.lang.String getFromClause()
        返回:
        SQL FROM clause part of SQL query string
      • setWhereClause

        public void setWhereClause​(java.lang.String whereClause)
        参数:
        whereClause - WHERE clause part of SQL query string
      • getWhereClause

        protected java.lang.String getWhereClause()
        返回:
        SQL WHERE clause part of SQL query string
      • setSortKeys

        public void setSortKeys​(java.util.Map<java.lang.String,​Order> sortKeys)
        参数:
        sortKeys - key to use to sort and limit page content
      • getSortKeys

        public java.util.Map<java.lang.String,​OrdergetSortKeys()
        A Map<String, Boolean> of sort columns as the key and boolean for ascending/descending (ascending = true).
        指定者:
        getSortKeys 在接口中 PagingQueryProvider
        返回:
        sortKey key to use to sort and limit page content
      • getSortKeyPlaceHolder

        public java.lang.String getSortKeyPlaceHolder​(java.lang.String keyName)
        The sort key placeholder will vary depending on whether named parameters or traditional placeholders are used in query strings.
        指定者:
        getSortKeyPlaceHolder 在接口中 PagingQueryProvider
        参数:
        keyName - The sort key name
        返回:
        place holder for sortKey.
      • init

        public void init​(javax.sql.DataSource dataSource)
                  throws java.lang.Exception
        Check mandatory properties.
        指定者:
        init 在接口中 PagingQueryProvider
        参数:
        dataSource - DataSource to use for any initialization
        抛出:
        java.lang.Exception - for errors when initializing
        另请参阅:
        InitializingBean.afterPropertiesSet()
      • generateFirstPageQuery

        public abstract java.lang.String generateFirstPageQuery​(int pageSize)
        Method generating the query string to be used for retrieving the first page. This method must be implemented in sub classes.
        指定者:
        generateFirstPageQuery 在接口中 PagingQueryProvider
        参数:
        pageSize - number of rows to read per page
        返回:
        query string
      • generateRemainingPagesQuery

        public abstract java.lang.String generateRemainingPagesQuery​(int pageSize)
        Method generating the query string to be used for retrieving the pages following the first page. This method must be implemented in sub classes.
        指定者:
        generateRemainingPagesQuery 在接口中 PagingQueryProvider
        参数:
        pageSize - number of rows to read per page
        返回:
        query string
      • generateJumpToItemQuery

        public abstract java.lang.String generateJumpToItemQuery​(int itemIndex,
                                                                 int pageSize)
        Method generating the query string to be used for jumping to a specific item position. This method must be implemented in sub classes.
        指定者:
        generateJumpToItemQuery 在接口中 PagingQueryProvider
        参数:
        itemIndex - the index of the item to jump to
        pageSize - number of rows to read per page
        返回:
        query string