Package org.apache.openjpa.persistence
Class QueryImpl<X>
java.lang.Object
org.apache.openjpa.persistence.AbstractQuery<X>
org.apache.openjpa.persistence.QueryImpl<X>
- All Implemented Interfaces:
jakarta.persistence.Query
,jakarta.persistence.TypedQuery<X>
,Serializable
,OpenJPAQuery<X>
,OpenJPAQuerySPI<X>
Implementation of
Query
interface.- Author:
- Marc Prud'hommeaux, Abe White
- See Also:
-
Field Summary
Fields inherited from class org.apache.openjpa.persistence.AbstractQuery
_boundParams, _convertPositionalParams, _declaredParams, _em, _qmd, _relaxBindParameterTypeChecking
Fields inherited from interface org.apache.openjpa.persistence.OpenJPAQuery
FLUSH_FALSE, FLUSH_TRUE, FLUSH_WITH_CONNECTION, HINT_RESULT_COUNT, OP_DELETE, OP_SELECT, OP_UPDATE
-
Constructor Summary
ConstructorDescriptionQueryImpl
(EntityManagerImpl em, Query query) Deprecated.QueryImpl
(EntityManagerImpl em, RuntimeExceptionTranslator ret, Query query) Deprecated.QueryImpl
(EntityManagerImpl em, RuntimeExceptionTranslator ret, Query query, QueryMetaData qmd) Constructor; supply factory exception translator and delegate. -
Method Summary
Modifier and TypeMethodDescriptionaddAggregateListener
(AggregateListener listener) Register an aggregate listener for the query.addFilterListener
(FilterListener listener) Register a filter listener for the query.protected void
closeAll()
Close all open query results.compile()
Compile the query.boolean
int
Collection<?>
Return the candidate collection, ornull
if an extent was specified instead of a collection.String[]
getDataStoreActions
(Map params) Returns a description of the commands that will be sent to the datastore in order to execute this query.Delegate.The owning entity manager.Fetch plan for controlling the loading of results.int
Return the 0-based start index for the returned results.jakarta.persistence.FlushModeType
Return the current flush mode.getHints()
Get all the active hints and their values.boolean
Whether to ignore changes in the current transaction.Query language.jakarta.persistence.LockModeType
int
Return the maximum number of results to retrieve.Query operation type.OrderedMap<Object,
Class<?>> Query string.Query result element type.Execute a query that returns a single result.Gets hints supported by this query.int
hashCode()
boolean
Whether subclasses are included in the query results.protected void
lock()
removeAggregateListener
(AggregateListener listener) Remove an aggregate listener from the query.removeFilterListener
(FilterListener listener) Remove a filter listener from the query.Set a collection of candidates.setFirstResult
(int startPosition) setFlushMode
(jakarta.persistence.FlushModeType flushMode) setIgnoreChanges
(boolean ignore) Whether to ignore changes in the current transaction.jakarta.persistence.TypedQuery<X>
setLockMode
(jakarta.persistence.LockModeType lockMode) Sets lock mode on the given query.setMaxResults
(int max) setResultClass
(Class cls) Query result element type.setSubclasses
(boolean subs) Whether subclasses are included in the query results.toString()
protected void
unlock()
<T> T
Unwraps this receiver to an instance of the given class, if possible.Methods inherited from class org.apache.openjpa.persistence.AbstractQuery
declareParameter, getBoundParameterKeys, getDeclaredParameterKeys, getDeclaredParameterKeys, getDeclaredParameters, getNamedParameters, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, getPositionalParameters, getRelaxBindParameterTypeChecking, hasPositionalParameters, isBound, isNative, isProcedure, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameters, setParameters, setRelaxBindParameterTypeChecking
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface jakarta.persistence.TypedQuery
getResultStream
-
Constructor Details
-
QueryImpl
public QueryImpl(EntityManagerImpl em, RuntimeExceptionTranslator ret, Query query, QueryMetaData qmd) Constructor; supply factory exception translator and delegate.- Parameters:
em
- The EntityManager which created this queryret
- Exception translator for this queryquery
- The underlying "kernel" query.
-
QueryImpl
Deprecated.Constructor; supply factory and delegate. -
QueryImpl
Deprecated.Constructor; supply factory and delegate.
-
-
Method Details
-
getDelegate
Delegate. -
getEntityManager
Description copied from interface:OpenJPAQuery
The owning entity manager.- Specified by:
getEntityManager
in interfaceOpenJPAQuery<X>
-
getLanguage
Description copied from interface:OpenJPAQuery
Query language.- Specified by:
getLanguage
in interfaceOpenJPAQuery<X>
-
getOperation
Description copied from interface:OpenJPAQuery
Query operation type.- Specified by:
getOperation
in interfaceOpenJPAQuery<X>
-
getFetchPlan
Description copied from interface:OpenJPAQuery
Fetch plan for controlling the loading of results.- Specified by:
getFetchPlan
in interfaceOpenJPAQuery<X>
-
getQueryString
Description copied from interface:OpenJPAQuery
Query string.- Specified by:
getQueryString
in interfaceOpenJPAQuery<X>
-
getIgnoreChanges
public boolean getIgnoreChanges()Description copied from interface:OpenJPAQuery
Whether to ignore changes in the current transaction.- Specified by:
getIgnoreChanges
in interfaceOpenJPAQuery<X>
-
setIgnoreChanges
Description copied from interface:OpenJPAQuery
Whether to ignore changes in the current transaction.- Specified by:
setIgnoreChanges
in interfaceOpenJPAQuery<X>
-
addFilterListener
Description copied from interface:OpenJPAQuerySPI
Register a filter listener for the query.- Specified by:
addFilterListener
in interfaceOpenJPAQuery<X>
- Specified by:
addFilterListener
in interfaceOpenJPAQuerySPI<X>
-
removeFilterListener
Description copied from interface:OpenJPAQuerySPI
Remove a filter listener from the query.- Specified by:
removeFilterListener
in interfaceOpenJPAQuery<X>
- Specified by:
removeFilterListener
in interfaceOpenJPAQuerySPI<X>
-
addAggregateListener
Description copied from interface:OpenJPAQuerySPI
Register an aggregate listener for the query.- Specified by:
addAggregateListener
in interfaceOpenJPAQuery<X>
- Specified by:
addAggregateListener
in interfaceOpenJPAQuerySPI<X>
-
removeAggregateListener
Description copied from interface:OpenJPAQuerySPI
Remove an aggregate listener from the query.- Specified by:
removeAggregateListener
in interfaceOpenJPAQuery<X>
- Specified by:
removeAggregateListener
in interfaceOpenJPAQuerySPI<X>
-
getCandidateCollection
Description copied from interface:OpenJPAQuery
Return the candidate collection, ornull
if an extent was specified instead of a collection.- Specified by:
getCandidateCollection
in interfaceOpenJPAQuery<X>
-
setCandidateCollection
Description copied from interface:OpenJPAQuery
Set a collection of candidates.- Specified by:
setCandidateCollection
in interfaceOpenJPAQuery<X>
-
getResultClass
Description copied from interface:OpenJPAQuery
Query result element type.- Specified by:
getResultClass
in interfaceOpenJPAQuery<X>
-
setResultClass
Description copied from interface:OpenJPAQuery
Query result element type.- Specified by:
setResultClass
in interfaceOpenJPAQuery<X>
-
hasSubclasses
public boolean hasSubclasses()Description copied from interface:OpenJPAQuery
Whether subclasses are included in the query results.- Specified by:
hasSubclasses
in interfaceOpenJPAQuery<X>
-
setSubclasses
Description copied from interface:OpenJPAQuery
Whether subclasses are included in the query results.- Specified by:
setSubclasses
in interfaceOpenJPAQuery<X>
-
getFirstResult
public int getFirstResult()Description copied from interface:OpenJPAQuery
Return the 0-based start index for the returned results.- Specified by:
getFirstResult
in interfaceOpenJPAQuery<X>
- Specified by:
getFirstResult
in interfacejakarta.persistence.Query
-
setFirstResult
- Specified by:
setFirstResult
in interfaceOpenJPAQuery<X>
- Specified by:
setFirstResult
in interfacejakarta.persistence.Query
- Specified by:
setFirstResult
in interfacejakarta.persistence.TypedQuery<X>
-
getMaxResults
public int getMaxResults()Description copied from interface:OpenJPAQuery
Return the maximum number of results to retrieve. orInteger.MAX_VALUE
for no limit.- Specified by:
getMaxResults
in interfaceOpenJPAQuery<X>
- Specified by:
getMaxResults
in interfacejakarta.persistence.Query
-
setMaxResults
- Specified by:
setMaxResults
in interfaceOpenJPAQuery<X>
- Specified by:
setMaxResults
in interfacejakarta.persistence.Query
- Specified by:
setMaxResults
in interfacejakarta.persistence.TypedQuery<X>
-
compile
Description copied from interface:OpenJPAQuery
Compile the query.- Specified by:
compile
in interfaceOpenJPAQuery<X>
-
getResultList
- Specified by:
getResultList
in interfacejakarta.persistence.Query
- Specified by:
getResultList
in interfacejakarta.persistence.TypedQuery<X>
-
getSingleResult
Execute a query that returns a single result.- Specified by:
getSingleResult
in interfacejakarta.persistence.Query
- Specified by:
getSingleResult
in interfacejakarta.persistence.TypedQuery<X>
-
executeUpdate
public int executeUpdate()- Specified by:
executeUpdate
in interfacejakarta.persistence.Query
-
getFlushMode
public jakarta.persistence.FlushModeType getFlushMode()Description copied from interface:OpenJPAQuery
Return the current flush mode.- Specified by:
getFlushMode
in interfaceOpenJPAQuery<X>
- Specified by:
getFlushMode
in interfacejakarta.persistence.Query
-
setFlushMode
- Specified by:
setFlushMode
in interfaceOpenJPAQuery<X>
- Specified by:
setFlushMode
in interfacejakarta.persistence.Query
- Specified by:
setFlushMode
in interfacejakarta.persistence.TypedQuery<X>
-
closeAll
Description copied from interface:OpenJPAQuery
Close all open query results.- Specified by:
closeAll
in interfaceOpenJPAQuery<X>
-
getDataStoreActions
Description copied from interface:OpenJPAQuery
Returns a description of the commands that will be sent to the datastore in order to execute this query. This will typically be in the native query language of the database (e.g., SQL).- Specified by:
getDataStoreActions
in interfaceOpenJPAQuery<X>
- Parameters:
params
- the named parameter map for the query invocation
-
getLockMode
public jakarta.persistence.LockModeType getLockMode()- Specified by:
getLockMode
in interfacejakarta.persistence.Query
-
setLockMode
Sets lock mode on the given query. If the target query has been prepared and cached, then ignores the cached version.- Specified by:
setLockMode
in interfacejakarta.persistence.Query
- Specified by:
setLockMode
in interfacejakarta.persistence.TypedQuery<X>
- See Also:
-
ignorePreparedQuery()
-
hashCode
public int hashCode() -
equals
-
getHints
Get all the active hints and their values.- Specified by:
getHints
in interfacejakarta.persistence.Query
-
setHint
- Specified by:
setHint
in interfaceOpenJPAQuery<X>
- Specified by:
setHint
in interfacejakarta.persistence.Query
- Specified by:
setHint
in interfacejakarta.persistence.TypedQuery<X>
-
getSupportedHints
Description copied from interface:OpenJPAQuery
Gets hints supported by this query.- Specified by:
getSupportedHints
in interfaceOpenJPAQuery<X>
-
unwrap
Unwraps this receiver to an instance of the given class, if possible.- Specified by:
unwrap
in interfacejakarta.persistence.Query
- Since:
- 2.0.0
-
lock
protected void lock()- Specified by:
lock
in classAbstractQuery<X>
-
unlock
protected void unlock()- Specified by:
unlock
in classAbstractQuery<X>
-
assertOpen
protected void assertOpen()- Specified by:
assertOpen
in classAbstractQuery<X>
-
getParamTypes
- Specified by:
getParamTypes
in classAbstractQuery<X>
- Returns:
- a map of parameter name to type for this query.
-
toString
-