Package com.blazebit.persistence
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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <Y> PaginatedCriteriaBuilder<Y>
copy(Class<Y> resultClass)
Copies this query builder into a new one, using it's projection as an overridable default.CriteriaBuilder<Object[]>
createPageIdQuery()
Creates and returns a newCriteriaBuilder
that can be used to query the id values for the current page.long
getBoundedCount()
Returns the maximum value up to which a count query should count.javax.persistence.TypedQuery<Long>
getCountQuery()
Returns the count query that selects the count of root elements.String
getCountQueryString()
Delegates togetPageCountQueryString()
.int
getHighestKeysetOffset()
Returns the offset of the highest keyset relative to the page size.String
getPageCountQueryString()
Returns the query string that selects the count of elements.String
getPageIdQueryString()
Returns the query string that selects the id of the elements.PaginatedTypedQuery<T>
getQuery()
Returns the paginated typed query for the built query.PagedList<T>
getResultList()
Execute the query and return the result as a type PagedList.boolean
isKeysetExtraction()
Returns whether keyset extraction is enabled or not.boolean
isWithCountQuery()
Returns whether count query execution is enabled or not.boolean
isWithExtractAllKeysets()
Returns whether keyset extraction is enabled or not.boolean
isWithForceIdQuery()
Returns whether id query use is forced.boolean
isWithInlineCountQuery()
Returns whether count query should be inlined.boolean
isWithInlineIdQuery()
Returns whether id query should be inlined.<Y> PaginatedCriteriaBuilder<Y>
selectNew(ObjectBuilder<Y> builder)
Applies the given object builder to this query.<Y> SelectObjectBuilder<PaginatedCriteriaBuilder<Y>>
selectNew(Class<Y> clazz)
Starts aSelectObjectBuilder
for the given class.PaginatedCriteriaBuilder<T>
withBoundedCount(long maximumCount)
Sets the maximum value up to which a count query should count.PaginatedCriteriaBuilder<T>
withCountQuery(boolean withCountQuery)
Enables or disables execution of the count query which determines whetherPagedList.getTotalSize()
is available.PaginatedCriteriaBuilder<T>
withExtractAllKeysets(boolean withExtractAllKeysets)
Enable or disables keyset extraction for all rows which influences whetherPagedList.getKeysetPage()
is available.PaginatedCriteriaBuilder<T>
withForceIdQuery(boolean withForceIdQuery)
Forces the use of an id query even if the pagination would not need it.PaginatedCriteriaBuilder<T>
withHighestKeysetOffset(int offset)
Sets the offset for the highest keyset which influences which element of a page is returned byKeysetPage.getHighest()
.PaginatedCriteriaBuilder<T>
withInlineCountQuery(boolean withInlineCountQuery)
Forces the inlining of an count query into the object or id query.PaginatedCriteriaBuilder<T>
withInlineIdQuery(boolean withInlineIdQuery)
Forces the inlining of an id query into the object query.PaginatedCriteriaBuilder<T>
withKeysetExtraction(boolean keysetExtraction)
Enable or disables keyset extraction which influences whetherPagedList.getKeysetPage()
is available.-
Methods inherited from interface com.blazebit.persistence.BaseQueryBuilder
getResultType
-
Methods inherited from interface com.blazebit.persistence.BaseWhereBuilder
where, whereCase, whereExists, whereExists, whereExpression, whereExpressionSubqueries, whereNotExists, whereNotExists, whereSimpleCase, whereSubqueries, whereSubquery, whereSubquery, whereSubquery, whereSubquery
-
Methods inherited from interface com.blazebit.persistence.CommonQueryBuilder
getCriteriaBuilderFactory, getMetamodel, isCacheable, registerMacro, setCacheable, setProperties, setProperty
-
Methods inherited from interface com.blazebit.persistence.spi.ConfigurationSource
getProperties, getProperty
-
Methods inherited from interface com.blazebit.persistence.FetchBuilder
fetch, fetch
-
Methods inherited from interface com.blazebit.persistence.FromBaseBuilder
fromEntitySubquery, fromEntitySubquery, fromEntitySubquery, fromSubquery, fromSubquery
-
Methods inherited from interface com.blazebit.persistence.FromBuilder
from, from, from, from, fromIdentifiableValues, fromIdentifiableValues, fromIdentifiableValues, fromIdentifiableValues, fromNew, fromNew, fromOld, fromOld, fromValues, fromValues, fromValues, fromValues, getFrom, getFromByPath, getPath, getRoots, innerJoin, innerJoinDefault, innerJoinDefaultOn, innerJoinLateralEntitySubquery, innerJoinLateralEntitySubquery, innerJoinLateralEntitySubquery, innerJoinLateralEntitySubquery, innerJoinLateralEntitySubquery, innerJoinLateralOnEntitySubquery, innerJoinLateralOnEntitySubquery, innerJoinLateralOnEntitySubquery, innerJoinLateralOnEntitySubquery, innerJoinLateralOnEntitySubquery, innerJoinLateralOnSubquery, innerJoinLateralOnSubquery, innerJoinLateralOnSubquery, innerJoinLateralOnSubquery, innerJoinLateralOnSubquery, innerJoinLateralSubquery, innerJoinLateralSubquery, innerJoinLateralSubquery, innerJoinLateralSubquery, innerJoinLateralSubquery, innerJoinOn, innerJoinOn, innerJoinOn, innerJoinOn, innerJoinOn, innerJoinOnEntitySubquery, innerJoinOnEntitySubquery, innerJoinOnEntitySubquery, innerJoinOnEntitySubquery, innerJoinOnEntitySubquery, innerJoinOnEntitySubquery, innerJoinOnEntitySubquery, innerJoinOnEntitySubquery, innerJoinOnSubquery, innerJoinOnSubquery, innerJoinOnSubquery, innerJoinOnSubquery, join, joinDefault, joinDefaultOn, joinLateralEntitySubquery, joinLateralEntitySubquery, joinLateralEntitySubquery, joinLateralEntitySubquery, joinLateralEntitySubquery, joinLateralOnEntitySubquery, joinLateralOnEntitySubquery, joinLateralOnEntitySubquery, joinLateralOnEntitySubquery, joinLateralOnEntitySubquery, joinLateralOnSubquery, joinLateralOnSubquery, joinLateralOnSubquery, joinLateralOnSubquery, joinLateralOnSubquery, joinLateralSubquery, joinLateralSubquery, joinLateralSubquery, joinLateralSubquery, joinLateralSubquery, joinOn, joinOn, joinOn, joinOn, joinOn, joinOnEntitySubquery, joinOnEntitySubquery, joinOnEntitySubquery, joinOnEntitySubquery, joinOnEntitySubquery, joinOnEntitySubquery, joinOnEntitySubquery, joinOnEntitySubquery, joinOnSubquery, joinOnSubquery, joinOnSubquery, joinOnSubquery, leftJoin, leftJoinDefault, leftJoinDefaultOn, leftJoinLateralEntitySubquery, leftJoinLateralEntitySubquery, leftJoinLateralEntitySubquery, leftJoinLateralEntitySubquery, leftJoinLateralEntitySubquery, leftJoinLateralOnEntitySubquery, leftJoinLateralOnEntitySubquery, leftJoinLateralOnEntitySubquery, leftJoinLateralOnEntitySubquery, leftJoinLateralOnEntitySubquery, leftJoinLateralOnSubquery, leftJoinLateralOnSubquery, leftJoinLateralOnSubquery, leftJoinLateralOnSubquery, leftJoinLateralOnSubquery, leftJoinLateralSubquery, leftJoinLateralSubquery, leftJoinLateralSubquery, leftJoinLateralSubquery, leftJoinLateralSubquery, leftJoinOn, leftJoinOn, leftJoinOn, leftJoinOn, leftJoinOn, leftJoinOnEntitySubquery, leftJoinOnEntitySubquery, leftJoinOnEntitySubquery, leftJoinOnEntitySubquery, leftJoinOnEntitySubquery, leftJoinOnEntitySubquery, leftJoinOnEntitySubquery, leftJoinOnEntitySubquery, leftJoinOnSubquery, leftJoinOnSubquery, leftJoinOnSubquery, leftJoinOnSubquery, rightJoin, rightJoinDefault, rightJoinDefaultOn, rightJoinOn, rightJoinOn, rightJoinOn, rightJoinOn, rightJoinOn, rightJoinOnEntitySubquery, rightJoinOnEntitySubquery, rightJoinOnEntitySubquery, rightJoinOnEntitySubquery, rightJoinOnEntitySubquery, rightJoinOnEntitySubquery, rightJoinOnEntitySubquery, rightJoinOnEntitySubquery, rightJoinOnSubquery, rightJoinOnSubquery, rightJoinOnSubquery, rightJoinOnSubquery
-
Methods inherited from interface com.blazebit.persistence.FullQueryBuilder
createPageIdQuery, createPageIdQuery, createPageIdQuery, createPageIdQuery, getCountQuery, getCountQueryString, innerJoinFetch, innerJoinFetchDefault, join, joinDefault, leftJoinFetch, leftJoinFetchDefault, page, page, page, pageAndNavigate, pageBy, pageBy, pageBy, pageBy, pageByAndNavigate, pageByAndNavigate, rightJoinFetch, rightJoinFetchDefault, selectNew
-
Methods inherited from interface com.blazebit.persistence.KeysetQueryBuilder
afterKeyset, afterKeyset, afterKeyset, beforeKeyset, beforeKeyset, beforeKeyset
-
Methods inherited from interface com.blazebit.persistence.OrderByBuilder
orderBy, orderBy, orderByAsc, orderByAsc, orderByDesc, orderByDesc
-
Methods inherited from interface com.blazebit.persistence.ParameterHolder
containsParameter, getParameter, getParameters, getParameterValue, isParameterSet, setParameter, setParameter, setParameter, setParameterType
-
Methods inherited from interface com.blazebit.persistence.Queryable
getQueryString, getSingleResult
-
Methods inherited from interface com.blazebit.persistence.QueryBuilder
getEntityManager
-
Methods inherited from interface com.blazebit.persistence.SelectBuilder
select, select, selectCase, selectCase, selectSimpleCase, selectSimpleCase, selectSubqueries, selectSubqueries, selectSubquery, selectSubquery, selectSubquery, selectSubquery, selectSubquery, selectSubquery, selectSubquery, selectSubquery
-
Methods inherited from interface com.blazebit.persistence.spi.ServiceProvider
getService
-
Methods inherited from interface com.blazebit.persistence.WhereBuilder
setWhereExpression, setWhereExpressionSubqueries, whereOr
-
Methods inherited from interface com.blazebit.persistence.WindowContainerBuilder
window
-
-
-
-
Method Detail
-
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 interfaceQueryable<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 computePaginatedTypedQuery.getTotalCount()
.- Specified by:
getCountQuery
in interfaceFullQueryBuilder<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()
Delegates togetPageCountQueryString()
.- Specified by:
getCountQueryString
in interfaceFullQueryBuilder<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 whetherPagedList.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 whetherPagedList.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 whetherPagedList.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 byKeysetPage.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 newCriteriaBuilder
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 interfaceQueryable<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 interfaceFullQueryBuilder<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 aSelectObjectBuilder
for the given class. The types of the parameter arguments used in theSelectObjectBuilder
must match a constructor of the given class.- Specified by:
selectNew
in interfaceFullQueryBuilder<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 interfaceFullQueryBuilder<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 typeY
- Returns:
- The query builder for chaining calls
-
-