Class StoredProcedureQueryImpl
java.lang.Object
org.apache.openjpa.persistence.StoredProcedureQueryImpl
- All Implemented Interfaces:
Query, StoredProcedureQuery
Implements Store Procedure based query for JPA facade.
A
This query resorts to a callback mechanism, where the execution of the query returns not a result, but a
A
stored procedure query differs from other query types because it may return
more than one result set, apart from an optional update count, whereas the traditional query processing in OpenJPA
via the abstractions of ResultObjectProvider and org.apache.openjpa.jdbc.sql.Result
assumed that a query will return its
result in a single list.
This query resorts to a callback mechanism, where the execution of the query returns not a result, but a
callback object that can be used to callback to OpenJPA kernel to get a series of
results via the traditional result processing pathway.- Author:
- Pinaki Poddar, Romain Manni-Bucau
-
Constructor Summary
ConstructorsConstructorDescriptionStoredProcedureQueryImpl(String procedureName, MultiQueryMetaData meta, QueryImpl<?> delegate) Construct a query for executing a Stored Procedure. -
Method Summary
Modifier and TypeMethodDescriptionbooleanexecute()Executes this receiver by delegation to the underlying executable query.intOpenJPAQuery<?> Gets the facade delegate that manages bind parameters on behalf of this receiver.Gets the kernel delegate that is handles actual execution on behalf of this receiver.intgetHints()intgetOutputParameterValue(int position) getOutputParameterValue(String parameterName) Parameter<?> getParameter(int position) <T> Parameter<T> getParameter(int position, Class<T> type) Parameter<?> getParameter(String name) <T> Parameter<T> getParameter(String name, Class<T> type) getParameterValue(int position) <T> TgetParameterValue(Parameter<T> param) getParameterValue(String name) intbooleanbooleanregisterStoredProcedureParameter(int position, Class type, ParameterMode mode) registerStoredProcedureParameter(String name, Class type, ParameterMode mode) setCacheRetrieveMode(CacheRetrieveMode cacheRetrieveMode) setCacheStoreMode(CacheStoreMode cacheStoreMode) setFirstResult(int startPosition) setFlushMode(FlushModeType flushMode) setLockMode(LockModeType lockMode) setMaxResults(int maxResult) setParameter(int position, Object value) setParameter(int position, Calendar value, TemporalType temporalType) setParameter(int position, Date value, TemporalType temporalType) setParameter(Parameter<Calendar> param, Calendar cal, TemporalType temporalType) setParameter(Parameter<Date> param, Date value, TemporalType temporalType) setParameter(Parameter<T> param, T value) setParameter(String name, Object value) setParameter(String name, Calendar cal, TemporalType temporalType) setParameter(String name, Date date, TemporalType temporalType) setTimeout(Integer timeout) Sets the query timeout in milliseconds.toString()<T> TMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Query
getResultStream
-
Constructor Details
-
StoredProcedureQueryImpl
public StoredProcedureQueryImpl(String procedureName, MultiQueryMetaData meta, QueryImpl<?> delegate) Construct a query for executing a Stored Procedure.- Parameters:
procedureName- name of the database stored procedure.meta-delegate- the delegate which manages bind parameters on behalf of this
-
-
Method Details
-
getDelegate
Gets the facade delegate that manages bind parameters on behalf of this receiver.- Returns:
-
getExecutableQuery
Gets the kernel delegate that is handles actual execution on behalf of this receiver.- Returns:
-
execute
public boolean execute()Executes this receiver by delegation to the underlying executable query.
This method is multi-call safe. The underlying executable query is executed only for the first invocation. Subsequent- Specified by:
executein interfaceStoredProcedureQuery
-
getResultList
- Specified by:
getResultListin interfaceQuery- Specified by:
getResultListin interfaceStoredProcedureQuery
-
getSingleResult
- Specified by:
getSingleResultin interfaceQuery- Specified by:
getSingleResultin interfaceStoredProcedureQuery
-
hasMoreResults
public boolean hasMoreResults()- Specified by:
hasMoreResultsin interfaceStoredProcedureQuery
-
getUpdateCount
public int getUpdateCount()- Specified by:
getUpdateCountin interfaceStoredProcedureQuery
-
executeUpdate
public int executeUpdate()- Specified by:
executeUpdatein interfaceQuery- Specified by:
executeUpdatein interfaceStoredProcedureQuery
-
getParameter
- Specified by:
getParameterin interfaceQuery
-
getParameter
- Specified by:
getParameterin interfaceQuery
-
isBound
-
getParameterValue
- Specified by:
getParameterValuein interfaceQuery
-
unwrap
-
setParameter
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceStoredProcedureQuery
-
setParameter
public StoredProcedureQuery setParameter(Parameter<Calendar> param, Calendar cal, TemporalType temporalType) - Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceStoredProcedureQuery
-
setParameter
public StoredProcedureQuery setParameter(Parameter<Date> param, Date value, TemporalType temporalType) - Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceStoredProcedureQuery
-
registerStoredProcedureParameter
public StoredProcedureQuery registerStoredProcedureParameter(int position, Class type, ParameterMode mode) - Specified by:
registerStoredProcedureParameterin interfaceStoredProcedureQuery
-
registerStoredProcedureParameter
public StoredProcedureQuery registerStoredProcedureParameter(String name, Class type, ParameterMode mode) - Specified by:
registerStoredProcedureParameterin interfaceStoredProcedureQuery
-
getOutputParameterValue
- Specified by:
getOutputParameterValuein interfaceStoredProcedureQuery
-
getOutputParameterValue
- Specified by:
getOutputParameterValuein interfaceStoredProcedureQuery
-
setMaxResults
- Specified by:
setMaxResultsin interfaceQuery
-
getMaxResults
public int getMaxResults()- Specified by:
getMaxResultsin interfaceQuery
-
setFirstResult
- Specified by:
setFirstResultin interfaceQuery
-
getFirstResult
public int getFirstResult()- Specified by:
getFirstResultin interfaceQuery
-
getHints
-
getParameters
- Specified by:
getParametersin interfaceQuery
-
getParameter
- Specified by:
getParameterin interfaceQuery
-
getParameter
- Specified by:
getParameterin interfaceQuery
-
getParameterValue
- Specified by:
getParameterValuein interfaceQuery
-
getParameterValue
- Specified by:
getParameterValuein interfaceQuery
-
getFlushMode
- Specified by:
getFlushModein interfaceQuery
-
setLockMode
- Specified by:
setLockModein interfaceQuery
-
getLockMode
- Specified by:
getLockModein interfaceQuery
-
setHint
- Specified by:
setHintin interfaceQuery- Specified by:
setHintin interfaceStoredProcedureQuery
-
setParameter
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceStoredProcedureQuery
-
setParameter
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceStoredProcedureQuery
-
setParameter
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceStoredProcedureQuery
-
setParameter
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceStoredProcedureQuery
-
setParameter
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceStoredProcedureQuery
-
setParameter
- Specified by:
setParameterin interfaceQuery- Specified by:
setParameterin interfaceStoredProcedureQuery
-
setFlushMode
- Specified by:
setFlushModein interfaceQuery- Specified by:
setFlushModein interfaceStoredProcedureQuery
-
toString
-
getCacheRetrieveMode
- Specified by:
getCacheRetrieveModein interfaceQuery
-
getCacheStoreMode
- Specified by:
getCacheStoreModein interfaceQuery
-
setCacheRetrieveMode
- Specified by:
setCacheRetrieveModein interfaceQuery- Specified by:
setCacheRetrieveModein interfaceStoredProcedureQuery
-
setCacheStoreMode
- Specified by:
setCacheStoreModein interfaceQuery- Specified by:
setCacheStoreModein interfaceStoredProcedureQuery
-
setTimeout
Sets the query timeout in milliseconds. A null timeout clears a timeout set through this method, restoring the timeout this query inherits from its entity manager, rather than leaving the previous value in place.- Specified by:
setTimeoutin interfaceQuery- Specified by:
setTimeoutin interfaceStoredProcedureQuery
-
getTimeout
- Specified by:
getTimeoutin interfaceQuery
-
getSingleResultOrNull
- Specified by:
getSingleResultOrNullin interfaceQuery- Specified by:
getSingleResultOrNullin interfaceStoredProcedureQuery
-