T
- The query result typeX
- The concrete builder typeBaseQueryBuilder<T,X>
, BaseWhereBuilder<T>
, CommonQueryBuilder<T>
, ConfigurationSource
, CorrelationQueryBuilder<T>
, FetchBuilder<X>
, FromBuilder<T>
, KeysetQueryBuilder<T>
, OrderByBuilder<T>
, ParameterHolder<T>
, Queryable<T,X>
, QueryBuilder<T,X>
, SelectBuilder<T>
, ServiceProvider
, WhereBuilder<T>
CriteriaBuilder<T>
, PaginatedCriteriaBuilder<T>
public interface FullQueryBuilder<T,X extends FullQueryBuilder<T,X>> extends QueryBuilder<T,X>, FetchBuilder<X>
Modifier and Type | Method | Description |
---|---|---|
<Y> FullQueryBuilder<Y,?> |
copy(Class<Y> resultClass) |
Copies this query builder into a new one, using it's projection as an overridable default.
|
javax.persistence.TypedQuery<Long> |
getCountQuery() |
Returns a query that counts the results that would be produced if the current query was run.
|
X |
innerJoinFetch(String path,
String alias) |
Like
join(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean) but with
JoinType.INNER and fetch set to true. |
X |
innerJoinFetchDefault(String path,
String alias) |
Like
joinDefault(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean) but with
JoinType.INNER and fetch set to true. |
X |
join(String path,
String alias,
JoinType type,
boolean fetch) |
Adds a join to the query, possibly specializing implicit joins, and giving the joined element an alias.
|
X |
joinDefault(String path,
String alias,
JoinType type,
boolean fetch) |
Adds a join to the query, possibly specializing implicit joins, and giving the joined element an alias.
|
X |
leftJoinFetch(String path,
String alias) |
Like
join(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean) but with
JoinType.LEFT and fetch set to true. |
X |
leftJoinFetchDefault(String path,
String alias) |
Like
joinDefault(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean) but with
JoinType.LEFT and fetch set to true. |
PaginatedCriteriaBuilder<T> |
page(int firstResult,
int maxResults) |
Paginates the results of this query.
|
PaginatedCriteriaBuilder<T> |
page(KeysetPage keysetPage,
int firstResult,
int maxResults) |
Like
page(int, int) but additionally uses key set pagination when possible. |
PaginatedCriteriaBuilder<T> |
page(Object entityId,
int maxResults) |
Paginates the results of this query and navigates to the page on which
the entity with the given entity id is located.
|
X |
rightJoinFetch(String path,
String alias) |
Like
join(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean) but with
JoinType.RIGHT and fetch set to true. |
X |
rightJoinFetchDefault(String path,
String alias) |
Like
joinDefault(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean) but with
JoinType.RIGHT and fetch set to true. |
<Y> FullQueryBuilder<Y,?> |
selectNew(ObjectBuilder<Y> builder) |
Applies the given object builder to this query.
|
<Y> SelectObjectBuilder<? extends FullQueryBuilder<Y,?>> |
selectNew(Class<Y> clazz) |
Starts a
SelectObjectBuilder for the given class. |
<Y> SelectObjectBuilder<? extends FullQueryBuilder<Y,?>> |
selectNew(Constructor<Y> constructor) |
Starts a
SelectObjectBuilder for the given constructor. |
getResultType
where, whereCase, whereExists, whereExists, whereNotExists, whereNotExists, whereSimpleCase, whereSubqueries, whereSubquery, whereSubquery, whereSubquery, whereSubquery
getCriteriaBuilderFactory, getMetamodel, isCacheable, registerMacro, setCacheable, setProperties, setProperty
getProperties, getProperty
fetch, fetch
from, from, fromIdentifiableValues, fromIdentifiableValues, fromNew, fromNew, fromOld, fromOld, fromValues, fromValues, getFrom, getFromByPath, getRoots, innerJoin, innerJoinDefault, innerJoinDefaultOn, innerJoinOn, innerJoinOn, innerJoinOn, join, joinDefault, joinDefaultOn, joinOn, joinOn, joinOn, leftJoin, leftJoinDefault, leftJoinDefaultOn, leftJoinOn, leftJoinOn, leftJoinOn, rightJoin, rightJoinDefault, rightJoinDefaultOn, rightJoinOn, rightJoinOn, rightJoinOn
afterKeyset, afterKeyset, afterKeyset, beforeKeyset, beforeKeyset, beforeKeyset
orderBy, orderByAsc, orderByAsc, orderByDesc, orderByDesc
containsParameter, getParameter, getParameters, getParameterValue, isParameterSet, setParameter, setParameter, setParameter, setParameterType
getQuery, getQueryString, getResultList, getSingleResult
getEntityManager
select, select, selectCase, selectCase, selectSimpleCase, selectSimpleCase, selectSubqueries, selectSubqueries, selectSubquery, selectSubquery, selectSubquery, selectSubquery, selectSubquery, selectSubquery, selectSubquery, selectSubquery
getService
setWhereExpression, setWhereExpressionSubqueries, whereOr
<Y> FullQueryBuilder<Y,?> copy(Class<Y> resultClass)
Y
- The type of the result classresultClass
- The result class of the queryjavax.persistence.TypedQuery<Long> getCountQuery()
PaginatedCriteriaBuilder<T> page(int firstResult, int maxResults)
Please note: The pagination only works on entity level and NOT on row level. This means that for queries which yield multiple result set rows per entity (i.e. rows with the same entity id), the multiple rows are treated as 1 page entry during the pagination process. Hence, the result set size of such paginated queries might be greater than the specified page size.
An example for such queries would be a query that joins a collection: SELECT d.id, contacts.name FROM Document d LEFT JOIN d.contacts contacts If one Document has associated multiple contacts, the above query will produce multiple result set rows for this document.
Since the pagination works on entity id level, the results are implicitly grouped by id and distinct. Therefore calling distinct() or groupBy() on a PaginatedCriteriaBuilder is not allowed.
firstResult
- The position of the first result to retrieve, numbered from 0maxResults
- The maximum number of results to retrievePaginatedCriteriaBuilder<T> page(Object entityId, int maxResults)
page(int, int)
apply.
If the entity with the given entity id does not exist in the result list:
PaginatedCriteriaBuilder.getResultList()
will contain the first pagePagedList.getFirstResult()
will return -1
entityId
- The id of the entity which should be located on the pagemaxResults
- The maximum number of results to retrievePaginatedCriteriaBuilder<T> page(KeysetPage keysetPage, int firstResult, int maxResults)
page(int, int)
but additionally uses key set pagination when possible.
Beware that keyset pagination should not be used as a direct replacement for offset pagination.
Since entries that have a lower rank than some keyset might be added or removed, the calculations
for the firstResult might be wrong. If strict pagination is required, then a keyset should
be thrown away when the count of lower ranked items changes to make use of offset pagination again.
Key set pagination is possible if and only if the following conditions are met:
KeysetPage.getMaxResults()
and maxResults
evaluate to the same value ANDKeysetPage.getFirstResult()
- firstResult
is 0KeysetPage.getFirstResult()
- firstResult
is equal to the value of
maxResults
keysetPage
- The key set from a previous result, may be nullfirstResult
- The position of the first result to retrieve, numbered from 0maxResults
- The maximum number of results to retrievePagedList.getKeysetPage()
X join(String path, String alias, JoinType type, boolean fetch)
path
- The path to joinalias
- The alias for the joined elementtype
- The join typefetch
- True if a join fetch should be addedX joinDefault(String path, String alias, JoinType type, boolean fetch)
path
- The path to joinalias
- The alias for the joined elementtype
- The join typefetch
- True if a join fetch should be addedX innerJoinFetch(String path, String alias)
join(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean)
but with
JoinType.INNER
and fetch set to true.path
- The path to joinalias
- The alias for the joined elementX innerJoinFetchDefault(String path, String alias)
joinDefault(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean)
but with
JoinType.INNER
and fetch set to true.path
- The path to joinalias
- The alias for the joined elementX leftJoinFetch(String path, String alias)
join(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean)
but with
JoinType.LEFT
and fetch set to true.path
- The path to joinalias
- The alias for the joined elementX leftJoinFetchDefault(String path, String alias)
joinDefault(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean)
but with
JoinType.LEFT
and fetch set to true.path
- The path to joinalias
- The alias for the joined elementX rightJoinFetch(String path, String alias)
join(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean)
but with
JoinType.RIGHT
and fetch set to true.path
- The path to joinalias
- The alias for the joined elementX rightJoinFetchDefault(String path, String alias)
joinDefault(java.lang.String, java.lang.String, com.blazebit.persistence.JoinType, boolean)
but with
JoinType.RIGHT
and fetch set to true.path
- The path to joinalias
- The alias for the joined element<Y> SelectObjectBuilder<? extends FullQueryBuilder<Y,?>> selectNew(Class<Y> clazz)
SelectObjectBuilder
for the given class. The types of the parameter arguments used in the
SelectObjectBuilder
must match a constructor of the given class.Y
- The new query result type specified by the given classclazz
- The class which should be used for the select new select clause<Y> SelectObjectBuilder<? extends FullQueryBuilder<Y,?>> selectNew(Constructor<Y> constructor)
SelectObjectBuilder
for the given constructor. The types of the parameter arguments used in the
SelectObjectBuilder
must match the given constructor.Y
- The new query result type specified by the given classconstructor
- The constructor which should be used for the select new select clause<Y> FullQueryBuilder<Y,?> selectNew(ObjectBuilder<Y> builder)
Y
- The new query result type specified by the given classbuilder
- The object builder which transforms the result set into objects of type Y
Copyright © 2014–2018 Blazebit. All rights reserved.