Interface PaginatedCriteriaBuilder<T>

Type Parameters:
T - The query result type
All Superinterfaces:
BaseQueryBuilder<T,​PaginatedCriteriaBuilder<T>>, BaseWhereBuilder<PaginatedCriteriaBuilder<T>>, CommonQueryBuilder<PaginatedCriteriaBuilder<T>>, ConfigurationSource, CorrelationQueryBuilder<PaginatedCriteriaBuilder<T>>, FetchBuilder<PaginatedCriteriaBuilder<T>>, FromBaseBuilder<PaginatedCriteriaBuilder<T>>, FromBuilder<PaginatedCriteriaBuilder<T>>, FromProvider, FullQueryBuilder<T,​PaginatedCriteriaBuilder<T>>, KeysetQueryBuilder<PaginatedCriteriaBuilder<T>>, OrderByBuilder<PaginatedCriteriaBuilder<T>>, ParameterHolder<PaginatedCriteriaBuilder<T>>, Queryable<T,​PaginatedCriteriaBuilder<T>>, QueryBuilder<T,​PaginatedCriteriaBuilder<T>>, SelectBuilder<PaginatedCriteriaBuilder<T>>, ServiceProvider, WhereBuilder<PaginatedCriteriaBuilder<T>>, WindowContainerBuilder<PaginatedCriteriaBuilder<T>>

public interface PaginatedCriteriaBuilder<T>
extends FullQueryBuilder<T,​PaginatedCriteriaBuilder<T>>
A builder for paginated criteria queries.
Since:
1.0.0
Author:
Christian Beikov
  • Method Details

    • getQuery

      PaginatedTypedQuery<T> getQuery()
      Returns the paginated typed query for the built query. The returned query is already parameterized with all known parameters.
      Specified by:
      getQuery in interface Queryable<T,​PaginatedCriteriaBuilder<T>>
      Returns:
      The paginated typed query for the built query
    • getCountQuery

      javax.persistence.TypedQuery<Long> getCountQuery()
      Returns the count query that selects the count of root elements. This is the same query that is used to compute PaginatedTypedQuery.getTotalCount().
      Specified by:
      getCountQuery in interface FullQueryBuilder<T,​PaginatedCriteriaBuilder<T>>
      Returns:
      A query for determining the count of the root elements represented by this query builder
      Since:
      1.3.0
    • getCountQueryString

      String getCountQueryString()
      Specified by:
      getCountQueryString in interface FullQueryBuilder<T,​PaginatedCriteriaBuilder<T>>
      Returns:
      The query string
      Since:
      1.3.0
    • getPageCountQueryString

      String getPageCountQueryString()
      Returns the query string that selects the count of elements.
      Returns:
      The query string
    • getPageIdQueryString

      String getPageIdQueryString()
      Returns the query string that selects the id of the elements.
      Returns:
      The query string
    • withKeysetExtraction

      PaginatedCriteriaBuilder<T> withKeysetExtraction​(boolean keysetExtraction)
      Enable or disables keyset extraction which influences whether PagedList.getKeysetPage() is available.
      Parameters:
      keysetExtraction - true to enable, false to disable keyset extraction
      Returns:
      The query builder for chaining calls
    • isKeysetExtraction

      boolean isKeysetExtraction()
      Returns whether keyset extraction is enabled or not.
      Returns:
      true when enabled, false otherwise
    • withExtractAllKeysets

      PaginatedCriteriaBuilder<T> withExtractAllKeysets​(boolean withExtractAllKeysets)
      Enable or disables keyset extraction for all rows which influences whether PagedList.getKeysetPage() is available.
      Parameters:
      withExtractAllKeysets - true to enable, false to disable keyset extraction for all rows
      Returns:
      The query builder for chaining calls
      Since:
      1.4.0
    • isWithExtractAllKeysets

      boolean isWithExtractAllKeysets()
      Returns whether keyset extraction is enabled or not.
      Returns:
      true when enabled, false otherwise
      Since:
      1.4.0
    • withCountQuery

      PaginatedCriteriaBuilder<T> withCountQuery​(boolean withCountQuery)
      Enables or disables execution of the count query which determines whether PagedList.getTotalSize() is available.
      Parameters:
      withCountQuery - true to enable, false to disable the count query execution
      Returns:
      The query builder for chaining calls
      Since:
      1.2.0
    • isWithCountQuery

      boolean isWithCountQuery()
      Returns whether count query execution is enabled or not.
      Returns:
      true when enabled, false otherwise
      Since:
      1.2.0
    • withBoundedCount

      PaginatedCriteriaBuilder<T> withBoundedCount​(long maximumCount)
      Sets the maximum value up to which a count query should count.
      Parameters:
      maximumCount - the maximum value up to which should be counted
      Returns:
      The query builder for chaining calls
      Since:
      1.5.0
    • getBoundedCount

      long getBoundedCount()
      Returns the maximum value up to which a count query should count.
      Returns:
      the maximum value up to which a count query should count
      Since:
      1.5.0
    • withForceIdQuery

      PaginatedCriteriaBuilder<T> withForceIdQuery​(boolean withForceIdQuery)
      Forces the use of an id query even if the pagination would not need it.
      Parameters:
      withForceIdQuery - true to force id query use, false otherwise
      Returns:
      The query builder for chaining calls
      Since:
      1.3.0
    • isWithForceIdQuery

      boolean isWithForceIdQuery()
      Returns whether id query use is forced.
      Returns:
      true when id query use is forced, false otherwise
      Since:
      1.3.0
    • withHighestKeysetOffset

      PaginatedCriteriaBuilder<T> withHighestKeysetOffset​(int offset)
      Sets the offset for the highest keyset which influences which element of a page is returned by KeysetPage.getHighest(). This is usually used when loading N + 1 rows to know there are further rows but only needing N rows.
      Parameters:
      offset - the offset for the highest keyset relative to the page size
      Returns:
      The query builder for chaining calls
      Since:
      1.2.0
    • getHighestKeysetOffset

      int getHighestKeysetOffset()
      Returns the offset of the highest keyset relative to the page size.
      Returns:
      the offset for the highest keyset relative to the page size
      Since:
      1.2.0
    • withInlineIdQuery

      PaginatedCriteriaBuilder<T> withInlineIdQuery​(boolean withInlineIdQuery)
      Forces the inlining of an id query into the object query.
      Parameters:
      withInlineIdQuery - true to inline the id query, false otherwise
      Returns:
      The query builder for chaining calls
      Since:
      1.4.1
    • isWithInlineIdQuery

      boolean isWithInlineIdQuery()
      Returns whether id query should be inlined.
      Returns:
      true when id query should be inlined, false otherwise
      Since:
      1.4.1
    • withInlineCountQuery

      PaginatedCriteriaBuilder<T> withInlineCountQuery​(boolean withInlineCountQuery)
      Forces the inlining of an count query into the object or id query.
      Parameters:
      withInlineCountQuery - true to inline the count query, false otherwise
      Returns:
      The query builder for chaining calls
      Since:
      1.4.1
    • isWithInlineCountQuery

      boolean isWithInlineCountQuery()
      Returns whether count query should be inlined.
      Returns:
      true when count query should be inlined, false otherwise
      Since:
      1.4.1
    • createPageIdQuery

      CriteriaBuilder<Object[]> createPageIdQuery()
      Creates and returns a new CriteriaBuilder that can be used to query the id values for the current page.
      Returns:
      the CriteriaBuilder to query id values
      Since:
      1.4.1
    • getResultList

      PagedList<T> getResultList()
      Execute the query and return the result as a type PagedList.
      Specified by:
      getResultList in interface Queryable<T,​PaginatedCriteriaBuilder<T>>
      Returns:
      The paged list of the results
    • copy

      <Y> PaginatedCriteriaBuilder<Y> copy​(Class<Y> resultClass)
      Description copied from interface: FullQueryBuilder
      Copies this query builder into a new one, using it's projection as an overridable default.
      Specified by:
      copy in interface FullQueryBuilder<T,​PaginatedCriteriaBuilder<T>>
      Type Parameters:
      Y - The type of the result class
      Parameters:
      resultClass - The result class of the query
      Returns:
      A new query builder
    • selectNew

      <Y> SelectObjectBuilder<PaginatedCriteriaBuilder<Y>> selectNew​(Class<Y> clazz)
      Description copied from interface: FullQueryBuilder
      Starts a SelectObjectBuilder for the given class. The types of the parameter arguments used in the SelectObjectBuilder must match a constructor of the given class.
      Specified by:
      selectNew in interface FullQueryBuilder<T,​PaginatedCriteriaBuilder<T>>
      Type Parameters:
      Y - The new query result type specified by the given class
      Parameters:
      clazz - The class which should be used for the select new select clause
      Returns:
      The select object builder for the given class
    • selectNew

      <Y> PaginatedCriteriaBuilder<Y> selectNew​(ObjectBuilder<Y> builder)
      Description copied from interface: FullQueryBuilder
      Applies the given object builder to this query. The object builder provides the select clauses and is used to transform the result set tuples.
      Specified by:
      selectNew in interface FullQueryBuilder<T,​PaginatedCriteriaBuilder<T>>
      Type Parameters:
      Y - The new query result type specified by the given class
      Parameters:
      builder - The object builder which transforms the result set into objects of type Y
      Returns:
      The query builder for chaining calls