Interface Query<T>
- All Known Implementing Classes:
BaseQuery
Deprecated, for removal: This API element is subject to removal in a future version.
An immutable object representing both the query and the result. The result is obtained lazily when one of the methods
in this interface is executed first time. The query is executed only once. Further calls will just return the
previously cached results.
- Since:
- 6.0
- Author:
- anistor@redhat.com
-
Method Summary
Modifier and TypeMethodDescriptionexecute()Deprecated, for removal: This API element is subject to removal in a future version.Executes the query (a SELECT statement).Deprecated, for removal: This API element is subject to removal in a future version.Due to Generic limitations the erased type must stay as the commons QueryResult.String[]Deprecated.since 11.0.intDeprecated.since 10.1.hitCountAccuracy(int hitCountAccuracy) Deprecated, for removal: This API element is subject to removal in a future version.Limits the required accuracy of the hit count for the indexed queries to an upper-bound.maxResults(int maxResults) Deprecated, for removal: This API element is subject to removal in a future version.Sets the maximum number of results to return.setParameter(String paramName, Object paramValue) Deprecated, for removal: This API element is subject to removal in a future version.Sets the value of a named parameter.setParameters(Map<String, Object> paramValues) Deprecated, for removal: This API element is subject to removal in a future version.Sets multiple named parameters at once.startOffset(long startOffset) Deprecated, for removal: This API element is subject to removal in a future version.Sets the starting offset into the overall result set.Deprecated, for removal: This API element is subject to removal in a future version.Set the timeout for this query.Methods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface Query
entryIterator, entryIterator, executeStatement, executeStatementAsync, getMaxResults, getParameters, getQueryString, getStartOffset, hasProjections, hitCountAccuracy, iterator, list, local, publish, scoreRequired
-
Method Details
-
execute
QueryResult<T> execute()Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryExecutes the query (a SELECT statement). Subsequent invocations cause the query to be re-executed.Executing a DELETE is also allowed. In this case, no results will be returned, but the number of affected entries will be returned as the hit count in the
QueryResult.- Specified by:
executein interfaceQuery<T>- Returns:
QueryResultwith the results.
-
executeAsync
CompletionStage<QueryResult<T>> executeAsync()Deprecated, for removal: This API element is subject to removal in a future version.Due to Generic limitations the erased type must stay as the commons QueryResult. Feel free to cast toQueryResultas needed in chained operations on the stage.- Specified by:
executeAsyncin interfaceQuery<T>- Returns:
- a stage when complete has the results
-
getResultSize
Deprecated.since 10.1. This will be removed in 12. It's closest replacement isQueryResult.hitCount()which returns an optional long.Gets the total number of results matching the query, ignoring pagination (startOffset, maxResults).- Returns:
- total number of results.
-
getProjection
Deprecated.since 11.0. This method will be removed in next major version. To find out if a query uses projections useQuery.hasProjections()- Returns:
- the values for query projections or
nullif the query does not have projections.
-
startOffset
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySets the starting offset into the overall result set. Must be equal or greater than 0. Use it in combination withQuery.maxResults(int)to implement pagination.- Specified by:
startOffsetin interfaceQuery<T>- Parameters:
startOffset- the start offset- Returns:
this, for method chaining
-
maxResults
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySets the maximum number of results to return. Must be equal or greater than 0. When 0 is set, the execution of the query will not return any results, but will still information about thetotal number of hits. Use it in combination withQuery.startOffset(long)to implement pagination.- Specified by:
maxResultsin interfaceQuery<T>- Parameters:
maxResults- the maximum number of results to return- Returns:
this, for method chaining
-
hitCountAccuracy
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QueryLimits the required accuracy of the hit count for the indexed queries to an upper-bound. Setting the hit-count-accuracy could improve the performance of queries targeting large data sets.- Specified by:
hitCountAccuracyin interfaceQuery<T>- Parameters:
hitCountAccuracy- The value to apply- Returns:
this, for method chaining
-
setParameter
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySets the value of a named parameter.- Specified by:
setParameterin interfaceQuery<T>- Parameters:
paramName- the parameters name (non-empty and not null)paramValue- a non-null value- Returns:
- itself
-
setParameters
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySets multiple named parameters at once. Parameter names cannot be empty ornull. Parameter values must not benull.- Specified by:
setParametersin interfaceQuery<T>- Parameters:
paramValues- a Map of parameters- Returns:
- itself
-
timeout
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:QuerySet the timeout for this query. If the query hasn't finished processing before the timeout, a timeout will be thrown. For queries that use the index, the timeout is handled on a best effort basis, and the supplied time is rounded to the nearest millisecond.
-
Queryinstead