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, _relaxBindParameterTypeCheckingFields 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
ConstructorsConstructorDescriptionQueryImpl(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 voidcloseAll()Close all open query results.compile()Compile the query.booleanintCollection<?>Return the candidate collection, ornullif 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.intReturn the 0-based start index for the returned results.jakarta.persistence.FlushModeTypeReturn the current flush mode.getHints()Get all the active hints and their values.booleanWhether to ignore changes in the current transaction.Query language.jakarta.persistence.LockModeTypeintReturn 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.inthashCode()booleanWhether subclasses are included in the query results.protected voidlock()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 voidunlock()<T> TUnwraps 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, setRelaxBindParameterTypeCheckingMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods 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:OpenJPAQueryThe owning entity manager.- Specified by:
getEntityManagerin interfaceOpenJPAQuery<X>
-
getLanguage
Description copied from interface:OpenJPAQueryQuery language.- Specified by:
getLanguagein interfaceOpenJPAQuery<X>
-
getOperation
Description copied from interface:OpenJPAQueryQuery operation type.- Specified by:
getOperationin interfaceOpenJPAQuery<X>
-
getFetchPlan
Description copied from interface:OpenJPAQueryFetch plan for controlling the loading of results.- Specified by:
getFetchPlanin interfaceOpenJPAQuery<X>
-
getQueryString
Description copied from interface:OpenJPAQueryQuery string.- Specified by:
getQueryStringin interfaceOpenJPAQuery<X>
-
getIgnoreChanges
public boolean getIgnoreChanges()Description copied from interface:OpenJPAQueryWhether to ignore changes in the current transaction.- Specified by:
getIgnoreChangesin interfaceOpenJPAQuery<X>
-
setIgnoreChanges
Description copied from interface:OpenJPAQueryWhether to ignore changes in the current transaction.- Specified by:
setIgnoreChangesin interfaceOpenJPAQuery<X>
-
addFilterListener
Description copied from interface:OpenJPAQuerySPIRegister a filter listener for the query.- Specified by:
addFilterListenerin interfaceOpenJPAQuery<X>- Specified by:
addFilterListenerin interfaceOpenJPAQuerySPI<X>
-
removeFilterListener
Description copied from interface:OpenJPAQuerySPIRemove a filter listener from the query.- Specified by:
removeFilterListenerin interfaceOpenJPAQuery<X>- Specified by:
removeFilterListenerin interfaceOpenJPAQuerySPI<X>
-
addAggregateListener
Description copied from interface:OpenJPAQuerySPIRegister an aggregate listener for the query.- Specified by:
addAggregateListenerin interfaceOpenJPAQuery<X>- Specified by:
addAggregateListenerin interfaceOpenJPAQuerySPI<X>
-
removeAggregateListener
Description copied from interface:OpenJPAQuerySPIRemove an aggregate listener from the query.- Specified by:
removeAggregateListenerin interfaceOpenJPAQuery<X>- Specified by:
removeAggregateListenerin interfaceOpenJPAQuerySPI<X>
-
getCandidateCollection
Description copied from interface:OpenJPAQueryReturn the candidate collection, ornullif an extent was specified instead of a collection.- Specified by:
getCandidateCollectionin interfaceOpenJPAQuery<X>
-
setCandidateCollection
Description copied from interface:OpenJPAQuerySet a collection of candidates.- Specified by:
setCandidateCollectionin interfaceOpenJPAQuery<X>
-
getResultClass
Description copied from interface:OpenJPAQueryQuery result element type.- Specified by:
getResultClassin interfaceOpenJPAQuery<X>
-
setResultClass
Description copied from interface:OpenJPAQueryQuery result element type.- Specified by:
setResultClassin interfaceOpenJPAQuery<X>
-
hasSubclasses
public boolean hasSubclasses()Description copied from interface:OpenJPAQueryWhether subclasses are included in the query results.- Specified by:
hasSubclassesin interfaceOpenJPAQuery<X>
-
setSubclasses
Description copied from interface:OpenJPAQueryWhether subclasses are included in the query results.- Specified by:
setSubclassesin interfaceOpenJPAQuery<X>
-
getFirstResult
public int getFirstResult()Description copied from interface:OpenJPAQueryReturn the 0-based start index for the returned results.- Specified by:
getFirstResultin interfaceOpenJPAQuery<X>- Specified by:
getFirstResultin interfacejakarta.persistence.Query
-
setFirstResult
- Specified by:
setFirstResultin interfaceOpenJPAQuery<X>- Specified by:
setFirstResultin interfacejakarta.persistence.Query- Specified by:
setFirstResultin interfacejakarta.persistence.TypedQuery<X>
-
getMaxResults
public int getMaxResults()Description copied from interface:OpenJPAQueryReturn the maximum number of results to retrieve. orInteger.MAX_VALUEfor no limit.- Specified by:
getMaxResultsin interfaceOpenJPAQuery<X>- Specified by:
getMaxResultsin interfacejakarta.persistence.Query
-
setMaxResults
- Specified by:
setMaxResultsin interfaceOpenJPAQuery<X>- Specified by:
setMaxResultsin interfacejakarta.persistence.Query- Specified by:
setMaxResultsin interfacejakarta.persistence.TypedQuery<X>
-
compile
Description copied from interface:OpenJPAQueryCompile the query.- Specified by:
compilein interfaceOpenJPAQuery<X>
-
getResultList
- Specified by:
getResultListin interfacejakarta.persistence.Query- Specified by:
getResultListin interfacejakarta.persistence.TypedQuery<X>
-
getSingleResult
Execute a query that returns a single result.- Specified by:
getSingleResultin interfacejakarta.persistence.Query- Specified by:
getSingleResultin interfacejakarta.persistence.TypedQuery<X>
-
executeUpdate
public int executeUpdate()- Specified by:
executeUpdatein interfacejakarta.persistence.Query
-
getFlushMode
public jakarta.persistence.FlushModeType getFlushMode()Description copied from interface:OpenJPAQueryReturn the current flush mode.- Specified by:
getFlushModein interfaceOpenJPAQuery<X>- Specified by:
getFlushModein interfacejakarta.persistence.Query
-
setFlushMode
- Specified by:
setFlushModein interfaceOpenJPAQuery<X>- Specified by:
setFlushModein interfacejakarta.persistence.Query- Specified by:
setFlushModein interfacejakarta.persistence.TypedQuery<X>
-
closeAll
Description copied from interface:OpenJPAQueryClose all open query results.- Specified by:
closeAllin interfaceOpenJPAQuery<X>
-
getDataStoreActions
Description copied from interface:OpenJPAQueryReturns 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:
getDataStoreActionsin interfaceOpenJPAQuery<X>- Parameters:
params- the named parameter map for the query invocation
-
getLockMode
public jakarta.persistence.LockModeType getLockMode()- Specified by:
getLockModein 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:
setLockModein interfacejakarta.persistence.Query- Specified by:
setLockModein interfacejakarta.persistence.TypedQuery<X>- See Also:
-
ignorePreparedQuery()
-
hashCode
public int hashCode() -
equals
-
getHints
Get all the active hints and their values.- Specified by:
getHintsin interfacejakarta.persistence.Query
-
setHint
- Specified by:
setHintin interfaceOpenJPAQuery<X>- Specified by:
setHintin interfacejakarta.persistence.Query- Specified by:
setHintin interfacejakarta.persistence.TypedQuery<X>
-
getSupportedHints
Description copied from interface:OpenJPAQueryGets hints supported by this query.- Specified by:
getSupportedHintsin interfaceOpenJPAQuery<X>
-
unwrap
Unwraps this receiver to an instance of the given class, if possible.- Specified by:
unwrapin interfacejakarta.persistence.Query- Since:
- 2.0.0
-
lock
protected void lock()- Specified by:
lockin classAbstractQuery<X>
-
unlock
protected void unlock()- Specified by:
unlockin classAbstractQuery<X>
-
assertOpen
protected void assertOpen()- Specified by:
assertOpenin classAbstractQuery<X>
-
getParamTypes
- Specified by:
getParamTypesin classAbstractQuery<X>- Returns:
- a map of parameter name to type for this query.
-
toString
-