Class Query<R>
- All Implemented Interfaces:
Serializable
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCopy ConstructorQuery(Selectable<?>[] selects, Type<?> type, Condition condition) Deprecated.Query(Selectable<? extends R> select) Query(Selectable<? extends R> select, Condition condition) Query(Selectable<? extends R> select, Query<?> query) Copy ConstructorQuery(Selectable<R> select, Type<?> type, Condition condition) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddOrderBy(Function<?> orderBy) voidaddOrderBy(Function<?> orderBy, boolean ascending) voidaddOrderBy(Selectable<?> orderBy) voidaddOrderBy(Selectable<?> orderBy, boolean ascending) voidaddOrderByDescending(Function<?> orderBy) voidaddOrderByDescending(Selectable<?> orderBy) intDeprecated.Usetotal()insteadstatic <R> Query.Result<R>Deprecated.UseQuery.Result.empty()insteadList<Selectable<?>>getJoins()intgetLimit()Deprecated.UsegetPageLimitOrMinusOne()instead.intDeprecated.UsegetPageOffset()instead.List<Selectable<?>>intintintintSelectable<? extends R>Type<?>getType()booleanDoes an inner join with the given type without any join condition.Does an inner join with the given type on the given join condition.joinOuterLeft(Type<?> type, Condition condition) joinOuterRight(Type<?> type, Condition condition) voidIf there is already a condition set for this query, this is equivalent to{@link #setCondition(Condition) setCondition}({@link #getCondition()}.{@link Condition#and(Condition) and}(narrowingCondition)).newQuery(Selectable<?>[] selects, Type<?> type, Condition condition) voidsearch()Searches for items matching this query.Deprecated.UsesearchAndTotal()insteadSearches for items matching this query.Searches equivalently tosearch(), but assumes that the search result has at most one element.Searches equivalently tosearch(), but assumes that the search result has exactly one element.Deprecated.renamed tosearchSingleton().voidsetCondition(Condition condition) voidsetDistinct(boolean distinct) voidsetGroupBy(Selectable<?>... groupBy) voidvoidsetLimit(int offset) Deprecated.UsesetPageUnlimited(int)instead.voidsetLimit(int offset, int limit) Deprecated.UsesetPage(int, int)instead.voidsetOrderBy(Function<?>[] orderBy, boolean[] ascending) voidsetOrderBy(Function<?> orderBy, boolean ascending) voidsetOrderBy(Selectable<?>[] orderBy, boolean[] ascending) voidsetOrderBy(Selectable<?> orderBy, boolean ascending) voidsetOrderByAndThis(Function<?> orderBy, boolean ascending) voidsetOrderByAndThis(Selectable<?> orderBy, boolean ascending) voidsetOrderByThis(boolean ascending) voidsetPage(int offset, int limit) voidsetPageUnlimited(int offset) voidsetSearchSizeCacheLimit(int searchSizeCacheLimit) Sets the search size cache limit for this query.voidsetSearchSizeLimit(int searchSizeLimit) Sets the search size limit for this query.voidsetSelect(Selectable<? extends R> select) voidsetSelects(Selectable<?>... selects) toString()inttotal()Counts the items matching this query.
-
Constructor Details
-
Query
-
Query
-
Query
Copy Constructor -
Query
Copy Constructor -
Query
-
Query
Deprecated.UsenewQuery(Selectable[], Type, Condition)instead
-
-
Method Details
-
newQuery
-
getSelectSingle
-
setSelect
-
setSelects
-
isDistinct
public boolean isDistinct() -
setDistinct
public void setDistinct(boolean distinct) -
getType
-
setCondition
-
getCondition
-
narrow
If there is already a condition set for this query, this is equivalent to{@link #setCondition(Condition) setCondition}({@link #getCondition()}.{@link Condition#and(Condition) and}(narrowingCondition)). -
join
Does an inner join with the given type without any join condition. -
join
Does an inner join with the given type on the given join condition. -
joinOuterLeft
-
joinOuterRight
-
getJoins
-
getGroupBy
-
setGroupBy
-
setHaving
-
getHaving
-
getOrderByFunctions
-
getOrderByAscending
-
setOrderByThis
public void setOrderByThis(boolean ascending) -
setOrderBy
-
setOrderByAndThis
-
setOrderBy
- Throws:
IllegalArgumentException- iforderBy.length!=ascending.length
-
addOrderBy
-
addOrderByDescending
-
addOrderBy
-
resetOrderBy
public void resetOrderBy() -
getPageOffset
public int getPageOffset() -
getPageLimitOrMinusOne
public int getPageLimitOrMinusOne() -
setPage
public void setPage(int offset, int limit) - Parameters:
limit- the maximum number of items to be found. For specifying offset but no limit usesetPageUnlimited(int)instead.- Throws:
IllegalArgumentException- if offset is a negative valueIllegalArgumentException- if limit is a negative value- See Also:
-
setPageUnlimited
public void setPageUnlimited(int offset) - Throws:
IllegalArgumentException- if offset is a negative value- See Also:
-
getSearchSizeLimit
public int getSearchSizeLimit()- See Also:
-
setSearchSizeLimit
public void setSearchSizeLimit(int searchSizeLimit) Sets the search size limit for this query.Method
search()will fail with anIllegalStateExceptionas soon as the size of the result set exceeds the search size limit. Methodtotal()is not affected by this limit.Setting the search size limit does not guarantee, that
search()actually fails when exceeding the limit. But it is guaranteed, that it does not fail when not exceeding the limit. In particular, it may not fail, if the result is fetched from the query cache.If search size limit is not set, it defaults to
ConnectProperties.getQuerySearchSizeLimit().- See Also:
-
getSearchSizeCacheLimit
public int getSearchSizeCacheLimit()- See Also:
-
setSearchSizeCacheLimit
public void setSearchSizeCacheLimit(int searchSizeCacheLimit) Sets the search size cache limit for this query.Results of method
search()will not be considered for inclusion into query cache as soon as the size of the result set exceeds the search size cache limit. Methodtotal()is not affected by this limit.Setting the search size cache limit does not guarantee, that
search()is not satisfied from the cache.If search size cache limit is not set, it defaults to
ConnectProperties.getQueryCacheSizeLimit().- See Also:
-
search
Searches for items matching this query.Returns an unmodifiable collection. Any attempts to modify the returned collection, whether direct or via its iterator, result in an
UnsupportedOperationException. -
total
public int total()Counts the items matching this query.Returns the
sizeof whatsearch()would have returned for this query withsetPageUnlimited(int)reset set to(0). -
searchAndTotal
Searches for items matching this query.Returns a
Query.Resultcontaining thedataand thetotal. Thedatais equal to whatsearch()would have returned for this query. Thetotalis equal to whattotal()would have returned for this query.This method does it's best to avoid issuing two queries for searching and totaling.
-
searchSingleton
Searches equivalently tosearch(), but assumes that the search result has at most one element.Returns null, if the search result is
empty, returns the only element of the search result, if the resultsizeis exactly one.- Throws:
IllegalArgumentException- if the search result size is greater than one.- See Also:
-
searchSingletonStrict
Searches equivalently tosearch(), but assumes that the search result has exactly one element.Returns the only element of the search result, if the result
sizeis exactly one.- Throws:
IllegalArgumentException- if the search result size is not exactly one.- See Also:
-
toString
-
setOrderBy
-
setOrderByAndThis
-
setOrderBy
-
addOrderBy
-
addOrderByDescending
-
addOrderBy
-
getOffset
Deprecated.UsegetPageOffset()instead. -
getLimit
Deprecated.UsegetPageLimitOrMinusOne()instead. -
setLimit
Deprecated.UsesetPage(int, int)instead. -
setLimit
Deprecated.UsesetPageUnlimited(int)instead. -
searchAndCountWithoutLimit
Deprecated.UsesearchAndTotal()instead -
countWithoutLimit
Deprecated.Usetotal()instead -
searchUnique
Deprecated.renamed tosearchSingleton(). -
emptyResult
Deprecated.UseQuery.Result.empty()instead
-
newQuery(Selectable[], Type, Condition)instead