public interface Query<T>
A query is executed by calling the method getResult()
.
QueryBuilder
Modifier and Type | Method and Description |
---|---|
String |
explain()
Returns a meaningful string representation of the query plan that is
used to compute the result of this query.
|
QueryResult<T> |
getResult()
Executes the query on the registered dataset(s), and returns a result object, ready to iterate.
|
void |
setFetchSize(int rows)
Provides a hint to the underlying database with the number of records
to fetch at a time from the result of
executing
this query. |
void |
setLocale(Locale aLocale)
Sets a locale to the query.
|
void |
setParameter(int aPosition,
Object aValue)
Sets a value to a positional parameter in the query.
|
void |
setSession(Session aSession)
Sets the user session on the query.
|
QueryResult<T> getResult() throws QueryPermissionException
QueryPermissionException
- if a session is provided and at least one forbidden node is used in the request.String explain()
void setSession(Session aSession)
Applying the permissions checks will have the following effects:
QueryPermissionException
will be thrown on execution if at least one
forbidden node is used in the query. Currently, this does not take into account record-dependent
access rules set on fields.setLocale(Locale)
void setLocale(Locale aLocale)
setSession(Session)
void setParameter(int aPosition, Object aValue)
A parameter is represented by a question mark ('?') in the query. The first position is 0:
Query<Tuple> query = dataset.createQuery("SELECT * FROM customer WHERE age = ? AND name = ?");
query.setParameter(0, 42);
query.setParameter(1, "John");
The type of the specified value should match the type of the parameter. See Sql Mapping of data types for more information.
void setFetchSize(int rows)
executing
this query. If the fetch size specified is '0', the underlying implementation
determines the fetch size independently.
See Setting a fetch size for the limitations when using PostgreSQL as the underlying database.
rows
- the number of rows to fetchRequest.setFetchSize(int)
,
Statement.setFetchSize(int)