Package org.apache.openjpa.persistence
Class StoredProcedureQueryImpl
java.lang.Object
org.apache.openjpa.persistence.StoredProcedureQueryImpl
- All Implemented Interfaces:
jakarta.persistence.Query
,jakarta.persistence.StoredProcedureQuery
public class StoredProcedureQueryImpl
extends Object
implements jakarta.persistence.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 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
ConstructorDescriptionStoredProcedureQueryImpl
(String procedureName, MultiQueryMetaData meta, QueryImpl<?> delegate) Construct a query for executing a Stored Procedure. -
Method Summary
Modifier and TypeMethodDescriptionboolean
execute()
Executes this receiver by delegation to the underlying executable query.int
OpenJPAQuery<?>
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.int
jakarta.persistence.FlushModeType
getHints()
jakarta.persistence.LockModeType
int
getOutputParameterValue
(int position) getOutputParameterValue
(String parameterName) jakarta.persistence.Parameter<?>
getParameter
(int position) <T> jakarta.persistence.Parameter<T>
getParameter
(int position, Class<T> type) jakarta.persistence.Parameter<?>
getParameter
(String name) <T> jakarta.persistence.Parameter<T>
getParameter
(String name, Class<T> type) Set<jakarta.persistence.Parameter<?>>
getParameterValue
(int position) <T> T
getParameterValue
(jakarta.persistence.Parameter<T> param) getParameterValue
(String name) int
boolean
boolean
isBound
(jakarta.persistence.Parameter<?> param) jakarta.persistence.StoredProcedureQuery
registerStoredProcedureParameter
(int position, Class type, jakarta.persistence.ParameterMode mode) jakarta.persistence.StoredProcedureQuery
registerStoredProcedureParameter
(String name, Class type, jakarta.persistence.ParameterMode mode) jakarta.persistence.Query
setFirstResult
(int startPosition) jakarta.persistence.StoredProcedureQuery
setFlushMode
(jakarta.persistence.FlushModeType flushMode) jakarta.persistence.StoredProcedureQuery
jakarta.persistence.Query
setLockMode
(jakarta.persistence.LockModeType lockMode) jakarta.persistence.Query
setMaxResults
(int maxResult) jakarta.persistence.StoredProcedureQuery
setParameter
(int position, Object value) jakarta.persistence.StoredProcedureQuery
setParameter
(int position, Calendar value, jakarta.persistence.TemporalType temporalType) jakarta.persistence.StoredProcedureQuery
setParameter
(int position, Date value, jakarta.persistence.TemporalType temporalType) jakarta.persistence.StoredProcedureQuery
setParameter
(jakarta.persistence.Parameter<Calendar> param, Calendar cal, jakarta.persistence.TemporalType temporalType) jakarta.persistence.StoredProcedureQuery
setParameter
(jakarta.persistence.Parameter<Date> param, Date value, jakarta.persistence.TemporalType temporalType) <T> jakarta.persistence.StoredProcedureQuery
setParameter
(jakarta.persistence.Parameter<T> param, T value) jakarta.persistence.StoredProcedureQuery
setParameter
(String name, Object value) jakarta.persistence.StoredProcedureQuery
setParameter
(String name, Calendar cal, jakarta.persistence.TemporalType temporalType) jakarta.persistence.StoredProcedureQuery
setParameter
(String name, Date date, jakarta.persistence.TemporalType temporalType) toString()
<T> T
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface jakarta.persistence.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:
execute
in interfacejakarta.persistence.StoredProcedureQuery
-
getResultList
- Specified by:
getResultList
in interfacejakarta.persistence.Query
- Specified by:
getResultList
in interfacejakarta.persistence.StoredProcedureQuery
-
getSingleResult
- Specified by:
getSingleResult
in interfacejakarta.persistence.Query
- Specified by:
getSingleResult
in interfacejakarta.persistence.StoredProcedureQuery
-
hasMoreResults
public boolean hasMoreResults()- Specified by:
hasMoreResults
in interfacejakarta.persistence.StoredProcedureQuery
-
getUpdateCount
public int getUpdateCount()- Specified by:
getUpdateCount
in interfacejakarta.persistence.StoredProcedureQuery
-
executeUpdate
public int executeUpdate()- Specified by:
executeUpdate
in interfacejakarta.persistence.Query
- Specified by:
executeUpdate
in interfacejakarta.persistence.StoredProcedureQuery
-
getParameter
- Specified by:
getParameter
in interfacejakarta.persistence.Query
-
getParameter
- Specified by:
getParameter
in interfacejakarta.persistence.Query
-
isBound
public boolean isBound(jakarta.persistence.Parameter<?> param) - Specified by:
isBound
in interfacejakarta.persistence.Query
-
getParameterValue
public <T> T getParameterValue(jakarta.persistence.Parameter<T> param) - Specified by:
getParameterValue
in interfacejakarta.persistence.Query
-
unwrap
- Specified by:
unwrap
in interfacejakarta.persistence.Query
-
setParameter
public <T> jakarta.persistence.StoredProcedureQuery setParameter(jakarta.persistence.Parameter<T> param, T value) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
setParameter
public jakarta.persistence.StoredProcedureQuery setParameter(jakarta.persistence.Parameter<Calendar> param, Calendar cal, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
setParameter
public jakarta.persistence.StoredProcedureQuery setParameter(jakarta.persistence.Parameter<Date> param, Date value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
registerStoredProcedureParameter
public jakarta.persistence.StoredProcedureQuery registerStoredProcedureParameter(int position, Class type, jakarta.persistence.ParameterMode mode) - Specified by:
registerStoredProcedureParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
registerStoredProcedureParameter
public jakarta.persistence.StoredProcedureQuery registerStoredProcedureParameter(String name, Class type, jakarta.persistence.ParameterMode mode) - Specified by:
registerStoredProcedureParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
getOutputParameterValue
- Specified by:
getOutputParameterValue
in interfacejakarta.persistence.StoredProcedureQuery
-
getOutputParameterValue
- Specified by:
getOutputParameterValue
in interfacejakarta.persistence.StoredProcedureQuery
-
setMaxResults
public jakarta.persistence.Query setMaxResults(int maxResult) - Specified by:
setMaxResults
in interfacejakarta.persistence.Query
-
getMaxResults
public int getMaxResults()- Specified by:
getMaxResults
in interfacejakarta.persistence.Query
-
setFirstResult
public jakarta.persistence.Query setFirstResult(int startPosition) - Specified by:
setFirstResult
in interfacejakarta.persistence.Query
-
getFirstResult
public int getFirstResult()- Specified by:
getFirstResult
in interfacejakarta.persistence.Query
-
getHints
- Specified by:
getHints
in interfacejakarta.persistence.Query
-
getParameters
- Specified by:
getParameters
in interfacejakarta.persistence.Query
-
getParameter
- Specified by:
getParameter
in interfacejakarta.persistence.Query
-
getParameter
public jakarta.persistence.Parameter<?> getParameter(int position) - Specified by:
getParameter
in interfacejakarta.persistence.Query
-
getParameterValue
- Specified by:
getParameterValue
in interfacejakarta.persistence.Query
-
getParameterValue
- Specified by:
getParameterValue
in interfacejakarta.persistence.Query
-
getFlushMode
public jakarta.persistence.FlushModeType getFlushMode()- Specified by:
getFlushMode
in interfacejakarta.persistence.Query
-
setLockMode
public jakarta.persistence.Query setLockMode(jakarta.persistence.LockModeType lockMode) - Specified by:
setLockMode
in interfacejakarta.persistence.Query
-
getLockMode
public jakarta.persistence.LockModeType getLockMode()- Specified by:
getLockMode
in interfacejakarta.persistence.Query
-
setHint
- Specified by:
setHint
in interfacejakarta.persistence.Query
- Specified by:
setHint
in interfacejakarta.persistence.StoredProcedureQuery
-
setParameter
- Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
setParameter
public jakarta.persistence.StoredProcedureQuery setParameter(String name, Calendar cal, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
setParameter
public jakarta.persistence.StoredProcedureQuery setParameter(String name, Date date, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
setParameter
- Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
setParameter
public jakarta.persistence.StoredProcedureQuery setParameter(int position, Calendar value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
setParameter
public jakarta.persistence.StoredProcedureQuery setParameter(int position, Date value, jakarta.persistence.TemporalType temporalType) - Specified by:
setParameter
in interfacejakarta.persistence.Query
- Specified by:
setParameter
in interfacejakarta.persistence.StoredProcedureQuery
-
setFlushMode
public jakarta.persistence.StoredProcedureQuery setFlushMode(jakarta.persistence.FlushModeType flushMode) - Specified by:
setFlushMode
in interfacejakarta.persistence.Query
- Specified by:
setFlushMode
in interfacejakarta.persistence.StoredProcedureQuery
-
toString
-