public interface Query
Note that it was modeled after the JCR Query interface.
| Modifier and Type | Field and Description |
|---|---|
static String |
HQL
Indicator for Hibernate Query Language.
|
static String |
XPATH
Indicator for XPath language.
|
static String |
XWQL
Indicator for XWiki Query Language.
|
| Modifier and Type | Method and Description |
|---|---|
Query |
addFilter(QueryFilter filter) |
Query |
bindValue(int index,
Object val)
Bind a positional parameter present in the statement (?index in XWQL) with a value.
|
default QueryParameter |
bindValue(String var)
Bind named parameter var with a value that will be constructed using calls to
QueryParameter.literal(String), QueryParameter.anychar() and QueryParameter.anyChars(). |
Query |
bindValue(String var,
Object val)
Bind named parameter var with value val in query statement.
|
Query |
bindValues(List<Object> values)
Bind a list of positional parameters values.
|
default Query |
bindValues(Map<String,?> values)
Bind a map of named parameters values.
|
<T> List<T> |
execute() |
List<QueryFilter> |
getFilters() |
String |
getLanguage() |
int |
getLimit() |
Map<String,Object> |
getNamedParameters() |
int |
getOffset() |
Map<Integer,Object> |
getPositionalParameters() |
String |
getStatement() |
String |
getWiki() |
boolean |
isNamed()
if the query is named, then
getStatement() returns a name of the query, else - a query statement. |
Query |
setLimit(int limit) |
Query |
setOffset(int offset) |
Query |
setWiki(String wiki) |
static final String HQL
static final String XPATH
static final String XWQL
boolean isNamed()
getStatement() returns a name of the query, else - a query statement.Query setWiki(String wiki)
wiki - virtual wiki to run the query. null is a current wiki.String getWiki()
setWiki(String)Query bindValue(String var, Object val)
var - variable in query statement (:var).val - value of the variable.Query bindValue(int index, Object val)
bindValue(String, Object).index - index of positional parameter. Index starting number depends on the query language. According to the
JPQL standard index should start from 1.val - value of the variable.Query bindValues(List<Object> values)
bindValue(int, Object).values - list of positional parameters values.bindValue(int, Object)default Query bindValues(Map<String,?> values)
bindValue(String, Object).values - list of positional parameters values.bindValue(String, Object)default QueryParameter bindValue(String var)
QueryParameter.literal(String), QueryParameter.anychar() and QueryParameter.anyChars().
In order to perserve the fluent API, it's also possible to call QueryParameter.query() to get back the
Query.var - the variable in the query statement (:var).QueryParameter that needs to be populated by calling
QueryParameter.literal(String), QueryParameter.anychar() and
QueryParameter.anyChars()Map<String,Object> getNamedParameters()
bindValue(String, Object)Map<Integer,Object> getPositionalParameters()
bindValue(int, Object)Query addFilter(QueryFilter filter)
filter - the QueryFilter to add to this queryList<QueryFilter> getFilters()
QueryFilters that will be applied to this queryQuery setLimit(int limit)
limit - see getLimit()Query setOffset(int offset)
offset - offset of query result to set (skip first "offset" rows)int getLimit()
execute().size() <= limit)setLimit(int)int getOffset()
setOffset(int)<T> List<T> execute() throws QueryException
T - expected type of elements in the result list.QueryException - if something goes wrong.Copyright © 2004–2021 XWiki. All rights reserved.