Class QueryImpl
- All Implemented Interfaces:
Query
- Direct Known Subclasses:
ResultSetMappingQuery
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidExecute an update or delete statement.intThe position of the first result the query object was set to retrieve.getHints()Gets the hints and associated values that are in effect for this query instance.intThe maximum number of results the query object was set to retrieve.Parameter<?>getParameter(int position) Gets the parameter object corresponding to the declared positional parameter with the given position.Parameter<?>getParameter(String name) Gets the parameter object corresponding to the declared parameter of the given name.Gets the parameter objects corresponding to the declared parameters of the query.getParameterValue(int position) Returns the input value bound to the positional parameter.<T> TgetParameterValue(Parameter<T> parameter) Returns the input value bound to the parameter.getParameterValue(String name) Returns the input value bound to the named parameter.Execute a SELECT query and return the query results as an untyped List.Execute a SELECT query and return the query results as an untyped java.util.stream.Stream.Execute a SELECT query that returns a single result.booleanhasParameter(int position) booleanhasParameter(String name) booleanReturns a boolean indicating whether a value has been bound to the parameter.setFirstResult(int startPosition) Set the position of the first result to retrieve.Sets a query hint.setMaxResults(int maxResults) Set the maximum number of results to retrieve.setParameter(int position, Object value) Binds an argument value to a positional parameter.setParameter(int position, String value, String language) Binds a String argument value to a positional parameter.setParameter(Parameter<String> parameter, String value, String language) Binds the value of a String Parameter.<T> QuerysetParameter(Parameter<T> parameter, T value) Binds the value of a Parameter object.setParameter(String name, Object value) Binds an argument value to a named parameter.setParameter(String name, String value, String language) Binds a String argument value to a named parameter.setUntypedParameter(int position, Object value) Binds an argument value to a positional parameter.<T> QuerysetUntypedParameter(Parameter<T> parameter, T value) Binds the value of a Parameter object.setUntypedParameter(String name, Object value) Binds an argument value to a named parameter.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface cz.cvut.kbss.jopa.model.query.Query
executeUpdate, getFirstResult, getHints, getMaxResults, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, setHint, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setUntypedParameter, setUntypedParameter, setUntypedParameter
-
Constructor Details
-
QueryImpl
-
-
Method Details
-
getResultList
Description copied from interface:QueryExecute a SELECT query and return the query results as an untyped List.- Specified by:
getResultListin interfaceQuery- Returns:
- a list of the results
-
getSingleResult
Description copied from interface:QueryExecute a SELECT query that returns a single result.- Specified by:
getSingleResultin interfaceQuery- Returns:
- Query result
-
getResultStream
Description copied from interface:QueryExecute a SELECT query and return the query results as an untyped java.util.stream.Stream.By default this method delegates to getResultList().stream(), however persistence provider may choose to override this method to provide additional capabilities.
- Specified by:
getResultStreamin interfaceQuery- Returns:
- a stream of the results
-
setMaxResults
Description copied from interface:QuerySet the maximum number of results to retrieve.- Specified by:
setMaxResultsin interfaceQuery- Parameters:
maxResults- maximum number of results- Returns:
- the same query instance
-
setFirstResult
Description copied from interface:QuerySet the position of the first result to retrieve.- Specified by:
setFirstResultin interfaceQuery- Parameters:
startPosition- position of the first result, numbered from 0- Returns:
- the same query instance
-
executeUpdate
public void executeUpdate()Description copied from interface:QueryExecute an update or delete statement.- Specified by:
executeUpdatein interfaceQuery
-
hasParameter
-
hasParameter
public boolean hasParameter(int position) -
getParameter
Description copied from interface:QueryGets the parameter object corresponding to the declared positional parameter with the given position. This method is not required to be supported for native queries.- Specified by:
getParameterin interfaceQuery- Parameters:
position- position- Returns:
- parameter object
-
getParameter
Description copied from interface:QueryGets the parameter object corresponding to the declared parameter of the given name. This method is not required to be supported for native queries.- Specified by:
getParameterin interfaceQuery- Parameters:
name- Parameter name- Returns:
- parameter object
-
getParameters
Description copied from interface:QueryGets the parameter objects corresponding to the declared parameters of the query. Returns empty set if the query has no parameters. This method is not required to be supported for native queries.- Specified by:
getParametersin interfaceQuery- Returns:
- set of parameter objects
-
isBound
Description copied from interface:QueryReturns a boolean indicating whether a value has been bound to the parameter. -
getParameterValue
Description copied from interface:QueryReturns the input value bound to the named parameter.- Specified by:
getParameterValuein interfaceQuery- Parameters:
name- parameter name- Returns:
- parameter value
-
getParameterValue
Description copied from interface:QueryReturns the input value bound to the positional parameter.- Specified by:
getParameterValuein interfaceQuery- Parameters:
position- position- Returns:
- parameter value
-
getParameterValue
Description copied from interface:QueryReturns the input value bound to the parameter.- Specified by:
getParameterValuein interfaceQuery- Parameters:
parameter- parameter object- Returns:
- parameter value
-
setParameter
Description copied from interface:QueryBinds an argument value to a positional parameter.This version exploits the type of the parameter value and maps it to the corresponding XSD datatype (if it exists).
- Specified by:
setParameterin interfaceQuery- Parameters:
position- positionvalue- parameter value- Returns:
- this query instance
- See Also:
-
setParameter
Description copied from interface:QueryBinds a String argument value to a positional parameter.- Specified by:
setParameterin interfaceQuery- Parameters:
position- positionvalue- parameter valuelanguage- language tag for the parameter value- Returns:
- this query instance
-
setParameter
Description copied from interface:QueryBinds an argument value to a named parameter.This version exploits the type of the parameter value and maps it to the corresponding XSD datatype (if it exists).
- Specified by:
setParameterin interfaceQuery- Parameters:
name- parameter namevalue- parameter value- Returns:
- this query instance
- See Also:
-
setParameter
Description copied from interface:QueryBinds a String argument value to a named parameter.- Specified by:
setParameterin interfaceQuery- Parameters:
name- parameter namevalue- parameter valuelanguage- language tag for the parameter value- Returns:
- this query instance
-
setUntypedParameter
Description copied from interface:QueryBinds an argument value to a positional parameter.This version does not express the type of the value in the query. Instead, it inserts the value directly into the query string. It can be useful, e.g., for specifying values in filters.
Do not use this method to set query limit and offset, use the
Query.setFirstResult(int)andQuery.setMaxResults(int)methods instead.- Specified by:
setUntypedParameterin interfaceQuery- Parameters:
position- positionvalue- parameter value- Returns:
- this query instance
-
setUntypedParameter
Description copied from interface:QueryBinds an argument value to a named parameter.This version does not express the type of the value in the query. Instead, it inserts the value directly into the query string. It can be useful, e.g., for specifying values in filters.
Do not use this method to set query limit and offset, use the
Query.setFirstResult(int)andQuery.setMaxResults(int)methods instead.- Specified by:
setUntypedParameterin interfaceQuery- Parameters:
name- parameter namevalue- parameter value- Returns:
- this query instance
-
getMaxResults
public int getMaxResults()Description copied from interface:QueryThe maximum number of results the query object was set to retrieve.Returns Integer.MAX_VALUE if
Query.setMaxResults(int)was not applied to the query object.- Specified by:
getMaxResultsin interfaceQuery- Returns:
- maximum number of results
-
getFirstResult
public int getFirstResult()Description copied from interface:QueryThe position of the first result the query object was set to retrieve.Returns 0 if
setFirstResultwas not applied to the query object.- Specified by:
getFirstResultin interfaceQuery- Returns:
- position of the first result
-
setParameter
Description copied from interface:QueryBinds the value of a Parameter object.This version exploits the type of the parameter value and maps it to the corresponding XSD datatype (if it exists).
- Specified by:
setParameterin interfaceQuery- Parameters:
parameter- parameter objectvalue- parameter value- Returns:
- this query instance
- See Also:
-
setParameter
Description copied from interface:QueryBinds the value of a String Parameter.- Specified by:
setParameterin interfaceQuery- Parameters:
parameter- parameter objectvalue- parameter valuelanguage- language tag for the parameter value- Returns:
- this query instance
-
setUntypedParameter
Description copied from interface:QueryBinds the value of a Parameter object.This version does not express the type of the value in the query. Instead, it inserts the value directly into the query string. It can be useful, e.g., for specifying values in filters.
Do not use this method to set query limit and offset, use the
Query.setFirstResult(int)andQuery.setMaxResults(int)methods instead.- Specified by:
setUntypedParameterin interfaceQuery- Parameters:
parameter- parameter objectvalue- parameter value- Returns:
- this query instance
-
setHint
Description copied from interface:QuerySets a query hint.The hint elements may be used to specify query properties and hints. Vendor-specific hints that are not recognized by a provider are silently ignored.
-
getHints
Description copied from interface:QueryGets the hints and associated values that are in effect for this query instance.
-