Package org.datanucleus.api.jpa
Class JPAStoredProcedureQuery
- java.lang.Object
-
- org.datanucleus.api.jpa.JPAQuery
-
- org.datanucleus.api.jpa.JPAStoredProcedureQuery
-
- All Implemented Interfaces:
javax.persistence.Query
,javax.persistence.StoredProcedureQuery
,javax.persistence.TypedQuery
public class JPAStoredProcedureQuery extends JPAQuery implements javax.persistence.StoredProcedureQuery
Implementation of a StoredProcedureQuery. Wraps an internal query.
-
-
Field Summary
-
Fields inherited from class org.datanucleus.api.jpa.JPAQuery
QUERY_HINT_FETCH_SIZE, QUERY_HINT_IGNORE_CACHE, QUERY_HINT_TIMEOUT
-
-
Constructor Summary
Constructors Constructor Description JPAStoredProcedureQuery(javax.persistence.EntityManager em, org.datanucleus.store.query.Query query)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
execute()
int
executeUpdate()
Method to execute a (UPDATE/DELETE) query returning the number of changed records.Object
getOutputParameterValue(int position)
Object
getOutputParameterValue(String parameterName)
List
getResultList()
Method to execute a (SELECT) query statement returning multiple results.Object
getSingleResult()
Method to execute a SELECT statement returning a single result.int
getUpdateCount()
boolean
hasMoreResults()
javax.persistence.StoredProcedureQuery
registerStoredProcedureParameter(int position, Class type, javax.persistence.ParameterMode mode)
javax.persistence.StoredProcedureQuery
registerStoredProcedureParameter(String parameterName, Class type, javax.persistence.ParameterMode mode)
JPAStoredProcedureQuery
setFlushMode(javax.persistence.FlushModeType mode)
Mutator for the flush mode.JPAStoredProcedureQuery
setHint(String hintName, Object value)
Method to add a vendor extension to the query.JPAStoredProcedureQuery
setParameter(int position, Object value)
Bind an argument to a positional parameter.JPAStoredProcedureQuery
setParameter(int position, Calendar value, javax.persistence.TemporalType temporalType)
Bind an instance of java.util.Calendar to a positional parameter.JPAStoredProcedureQuery
setParameter(int position, Date value, javax.persistence.TemporalType temporalType)
Bind an instance of java.util.Date to a positional parameter.JPAStoredProcedureQuery
setParameter(String name, Object value)
Bind an argument to a named parameter.JPAStoredProcedureQuery
setParameter(String name, Calendar value, javax.persistence.TemporalType temporalType)
Bind an instance of java.util.Calendar to a named parameter.JPAStoredProcedureQuery
setParameter(String name, Date date, javax.persistence.TemporalType type)
Bind an instance of java.util.Date to a named parameter.JPAStoredProcedureQuery
setParameter(javax.persistence.Parameter param, Object value)
Bind the value of a Parameter object.JPAStoredProcedureQuery
setParameter(javax.persistence.Parameter param, Calendar cal, javax.persistence.TemporalType type)
JPAStoredProcedureQuery
setParameter(javax.persistence.Parameter param, Date date, javax.persistence.TemporalType type)
-
Methods inherited from class org.datanucleus.api.jpa.JPAQuery
getFetchPlan, getFirstResult, getFlushMode, getHints, getInternalQuery, getLanguage, getLockMode, getMaxResults, getNativeQuery, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, getSupportedHints, isBound, isNativeQuery, loadParameters, loadParametersForCompilation, saveAsNamedQuery, setFirstResult, setLockMode, setMaxResults, toString, unwrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Method Detail
-
setParameter
public JPAStoredProcedureQuery setParameter(javax.persistence.Parameter param, Object value)
Description copied from class:JPAQuery
Bind the value of a Parameter object.- Specified by:
setParameter
in interfacejavax.persistence.Query
- Specified by:
setParameter
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setParameter
in interfacejavax.persistence.TypedQuery
- Overrides:
setParameter
in classJPAQuery
- Parameters:
param
- parameter to be setvalue
- parameter value- Returns:
- query instance
-
setParameter
public JPAStoredProcedureQuery setParameter(javax.persistence.Parameter param, Calendar cal, javax.persistence.TemporalType type)
- Specified by:
setParameter
in interfacejavax.persistence.Query
- Specified by:
setParameter
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setParameter
in interfacejavax.persistence.TypedQuery
- Overrides:
setParameter
in classJPAQuery
-
setParameter
public JPAStoredProcedureQuery setParameter(javax.persistence.Parameter param, Date date, javax.persistence.TemporalType type)
- Specified by:
setParameter
in interfacejavax.persistence.Query
- Specified by:
setParameter
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setParameter
in interfacejavax.persistence.TypedQuery
- Overrides:
setParameter
in classJPAQuery
-
setParameter
public JPAStoredProcedureQuery setParameter(String name, Object value)
Description copied from class:JPAQuery
Bind an argument to a named parameter.- Specified by:
setParameter
in interfacejavax.persistence.Query
- Specified by:
setParameter
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setParameter
in interfacejavax.persistence.TypedQuery
- Overrides:
setParameter
in classJPAQuery
- Parameters:
name
- the parameter namevalue
- The value for the param- Returns:
- the same query instance
-
setParameter
public JPAStoredProcedureQuery setParameter(String name, Calendar value, javax.persistence.TemporalType temporalType)
Description copied from class:JPAQuery
Bind an instance of java.util.Calendar to a named parameter.- Specified by:
setParameter
in interfacejavax.persistence.Query
- Specified by:
setParameter
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setParameter
in interfacejavax.persistence.TypedQuery
- Overrides:
setParameter
in classJPAQuery
- Parameters:
name
- name of the paramvalue
- Value for the paramtemporalType
- The temporal type- Returns:
- the same query instance
-
setParameter
public JPAStoredProcedureQuery setParameter(String name, Date date, javax.persistence.TemporalType type)
Description copied from class:JPAQuery
Bind an instance of java.util.Date to a named parameter.- Specified by:
setParameter
in interfacejavax.persistence.Query
- Specified by:
setParameter
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setParameter
in interfacejavax.persistence.TypedQuery
- Overrides:
setParameter
in classJPAQuery
- Parameters:
name
- Name of the paramdate
- Value for the paramtype
- The temporal type- Returns:
- the same query instance
-
setParameter
public JPAStoredProcedureQuery setParameter(int position, Object value)
Description copied from class:JPAQuery
Bind an argument to a positional parameter.- Specified by:
setParameter
in interfacejavax.persistence.Query
- Specified by:
setParameter
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setParameter
in interfacejavax.persistence.TypedQuery
- Overrides:
setParameter
in classJPAQuery
- Parameters:
position
- Parameter positionvalue
- The value- Returns:
- the same query instance
-
setParameter
public JPAStoredProcedureQuery setParameter(int position, Calendar value, javax.persistence.TemporalType temporalType)
Description copied from class:JPAQuery
Bind an instance of java.util.Calendar to a positional parameter.- Specified by:
setParameter
in interfacejavax.persistence.Query
- Specified by:
setParameter
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setParameter
in interfacejavax.persistence.TypedQuery
- Overrides:
setParameter
in classJPAQuery
- Parameters:
position
- Parameter positionvalue
- Value for the paramtemporalType
- Temporal type- Returns:
- the same query instance
-
setParameter
public JPAStoredProcedureQuery setParameter(int position, Date value, javax.persistence.TemporalType temporalType)
Description copied from class:JPAQuery
Bind an instance of java.util.Date to a positional parameter.- Specified by:
setParameter
in interfacejavax.persistence.Query
- Specified by:
setParameter
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setParameter
in interfacejavax.persistence.TypedQuery
- Overrides:
setParameter
in classJPAQuery
- Parameters:
position
- Parameter positionvalue
- Value for the paramtemporalType
- Temporal Type- Returns:
- the same query instance
-
registerStoredProcedureParameter
public javax.persistence.StoredProcedureQuery registerStoredProcedureParameter(int position, Class type, javax.persistence.ParameterMode mode)
- Specified by:
registerStoredProcedureParameter
in interfacejavax.persistence.StoredProcedureQuery
-
registerStoredProcedureParameter
public javax.persistence.StoredProcedureQuery registerStoredProcedureParameter(String parameterName, Class type, javax.persistence.ParameterMode mode)
- Specified by:
registerStoredProcedureParameter
in interfacejavax.persistence.StoredProcedureQuery
-
getOutputParameterValue
public Object getOutputParameterValue(int position)
- Specified by:
getOutputParameterValue
in interfacejavax.persistence.StoredProcedureQuery
-
getOutputParameterValue
public Object getOutputParameterValue(String parameterName)
- Specified by:
getOutputParameterValue
in interfacejavax.persistence.StoredProcedureQuery
-
execute
public boolean execute()
- Specified by:
execute
in interfacejavax.persistence.StoredProcedureQuery
-
hasMoreResults
public boolean hasMoreResults()
- Specified by:
hasMoreResults
in interfacejavax.persistence.StoredProcedureQuery
-
getUpdateCount
public int getUpdateCount()
- Specified by:
getUpdateCount
in interfacejavax.persistence.StoredProcedureQuery
-
executeUpdate
public int executeUpdate()
Description copied from class:JPAQuery
Method to execute a (UPDATE/DELETE) query returning the number of changed records.- Specified by:
executeUpdate
in interfacejavax.persistence.Query
- Overrides:
executeUpdate
in classJPAQuery
- Returns:
- Number of records updated/deleted with the query.
-
getResultList
public List getResultList()
Description copied from class:JPAQuery
Method to execute a (SELECT) query statement returning multiple results.- Specified by:
getResultList
in interfacejavax.persistence.Query
- Specified by:
getResultList
in interfacejavax.persistence.TypedQuery
- Overrides:
getResultList
in classJPAQuery
- Returns:
- The results
-
getSingleResult
public Object getSingleResult()
Description copied from class:JPAQuery
Method to execute a SELECT statement returning a single result.- Specified by:
getSingleResult
in interfacejavax.persistence.Query
- Specified by:
getSingleResult
in interfacejavax.persistence.TypedQuery
- Overrides:
getSingleResult
in classJPAQuery
- Returns:
- the result
-
setFlushMode
public JPAStoredProcedureQuery setFlushMode(javax.persistence.FlushModeType mode)
Description copied from class:JPAQuery
Mutator for the flush mode.- Specified by:
setFlushMode
in interfacejavax.persistence.Query
- Specified by:
setFlushMode
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setFlushMode
in interfacejavax.persistence.TypedQuery
- Overrides:
setFlushMode
in classJPAQuery
- Parameters:
mode
- Flush mode- Returns:
- The query
-
setHint
public JPAStoredProcedureQuery setHint(String hintName, Object value)
Description copied from class:JPAQuery
Method to add a vendor extension to the query. If the hint name is not recognized, it is silently ignored.- Specified by:
setHint
in interfacejavax.persistence.Query
- Specified by:
setHint
in interfacejavax.persistence.StoredProcedureQuery
- Specified by:
setHint
in interfacejavax.persistence.TypedQuery
- Overrides:
setHint
in classJPAQuery
- Parameters:
hintName
- Name of the "hint"value
- Value for the "hint"- Returns:
- the same query instance
-
-