Stored procedure query execution may be controlled in accordance with the following:
setParameter methods are used to set the values of
all required IN and INOUT parameters. It is not
required to set the values of stored procedure parameters for which
default values have been defined by the stored procedure.getResultList and getSingleResult are
called on a StoredProcedureQuery object, the provider calls
execute on an unexecuted stored procedure query before
processing getResultList or getSingleResult.executeUpdate is called on a
StoredProcedureQuery object, the provider will call
execute on an unexecuted stored procedure query, followed
by getUpdateCount. The results of executeUpdate will
be those of getUpdateCount.execute method supports both the simple case where
scalar results are passed back only via INOUT and OUT
parameters as well as the most general case (multiple result sets
and/or update counts, possibly also in combination with output
parameter values).execute method returns true if the first result is
a result set, and false if it is an update count or there are no
results other than through INOUT and OUT parameters,
if any.execute method returns true, the pending result
set can be obtained by calling getResultList or
getSingleResult.hasMoreResults method can then be used to test for
further results.execute or hasMoreResults returns false, the
getUpdateCount method can be called to obtain the pending
result if it is an update count. The getUpdateCount method
will return either the update count (zero or greater) or -1 if there
is no update count (i.e., either the next result is a result set or
there is no next update count).INOUT or OUT parameters are extracted.getResultList and
getUpdateCount have been exhausted, results returned through
INOUT and OUT parameters can be retrieved.getOutputParameterValue methods are used to
retrieve the values passed back from the procedure through
INOUT and OUT parameters.REF_CURSOR parameters for result sets the
update counts should be exhausted before calling getResultList
to retrieve the result set. Alternatively, the REF_CURSOR
result set can be retrieved through getOutputParameterValue.
Result set mappings are applied to results corresponding to
REF_CURSOR parameters in the order the REF_CURSOR
parameters were registered with the query.INOUT and OUT parameters, execute can be
followed immediately by calls to getOutputParameterValue.
Query, Parameter
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if first result corresponds to result setReturn true if the first result corresponds to a result set, and false if it is an update count or if there are no results other than through INOUT and OUT parameters, if any. |
| public int | Returns: the update count or -1 if there is no pending result or if the next result is not an update count.Redeclares jakarta. Return the update count of -1 if there is no pending result or if the first result is not an update count. |
| public Object | Returns: the result that is passed back through the parameterparameter position position)Retrieve a value passed back from the procedure through an INOUT or OUT parameter. |
| public Object | Returns: the result that is passed back through the parametername of the parameter as registered or
specified in metadata parameterName)Retrieve a value passed back from the procedure through an INOUT or OUT parameter. |
| public List | Returns: a list of the results or null is the next item is not a result setRedeclares jakarta. Retrieve the list of results from the next result set. |
| public Object | Returns: the result or null if the next item is not a result setRedeclares jakarta. Retrieve a single result from the next result set. |
| public Object | Returns: the result or null if the next item is not a result set or if there is no result in the next result setRedeclares jakarta. Retrieve a single result from the next result set. |
| public int | Returns: update count or -1 if there is no pending result or if the next result is not an update countReturn the update count or -1 if there is no pending result or if the next result is not an update count. |
| public boolean | Returns: true if next result corresponds to result setReturn true if the next result corresponds to a result set, and false if it is an update count or if there are no results other than through INOUT and OUT parameters, if any. |
| public StoredProcedureQuery | Returns: the same query instanceparameter position position, Class<?> type of the parameter type, ParameterMode parameter mode mode)Register a positional parameter. |
| public StoredProcedureQuery | Returns: the same query instancename of the parameter as registered or
specified in metadata parameterName, Class<?> type of the parameter type, ParameterMode parameter mode mode)Register a named parameter. |
| public StoredProcedureQuery | Returns: the same query instancecache retrieval mode cacheRetrieveMode)Redeclares jakarta. Set the cache retrieval mode that is in effect during query execution. |
| public StoredProcedureQuery | Returns: the same query instancecache storage mode cacheStoreMode)Redeclares jakarta. Set the cache storage mode that is in effect during query execution. |
| public StoredProcedureQuery | Returns: the same query instanceflush mode flushMode)Redeclares jakarta. Set the flush mode type to be used for the query execution. |
| public StoredProcedureQuery | Returns: the same query instancename of the property or hint hintName, Object value for the property or hint value)Redeclares jakarta. Set a query property or hint. |
| public <T> StoredProcedureQuery | Returns: the same query instanceparameter object param, T parameter value value)Redeclares jakarta. Bind the value of a |
| public StoredProcedureQuery | Returns: the same query instanceparameter object param, Calendar parameter value value, TemporalType temporal type temporalType)Redeclares jakarta.
Deprecated
since 3.2. Newly-written code should use the date/time types
defined in
java..
Bind an instance of |
| public StoredProcedureQuery | Returns: the same query instanceparameter object param, Date parameter value value, TemporalType temporal type temporalType)Redeclares jakarta.
Deprecated
since 3.2. Newly-written code should use the date/time types
defined in
java..
Bind an instance of |
| public StoredProcedureQuery | Returns: the same query instanceparameter name name, Object parameter value value)Redeclares jakarta. Bind an argument value to a named parameter. |
| public StoredProcedureQuery | Returns: the same query instanceparameter name name, Calendar parameter value value, TemporalType temporal type temporalType)Redeclares jakarta.
Deprecated
since 3.2. Newly-written code should use the date/time types
defined in
java..
Bind an instance of |
| public StoredProcedureQuery | Returns: the same query instanceparameter name name, Date parameter value value, TemporalType temporal type temporalType)Redeclares jakarta.
Deprecated
since 3.2. Newly-written code should use the date/time types
defined in
java..
Bind an instance of |
| public StoredProcedureQuery | Returns: the same query instanceposition position, Object parameter value value)Redeclares jakarta. Bind an argument value to a positional parameter. |
| public StoredProcedureQuery | Returns: the same query instanceposition position, Calendar parameter value value, TemporalType temporal type temporalType)Redeclares jakarta.
Deprecated
since 3.2. Newly-written code should use the date/time types
defined in
java..
Bind an instance of |
| public StoredProcedureQuery | Returns: the same query instanceposition position, Date parameter value value, TemporalType temporal type temporalType)Redeclares jakarta.
Deprecated
since 3.2. Newly-written code should use the date/time types
defined in
java..
Bind an instance of |
| public StoredProcedureQuery | Returns: the same query instancethe timeout, in milliseconds, or null to
indicate no timeout timeout)Redeclares jakarta. Set the query timeout, in milliseconds. |
| execute | back to summary |
|---|---|
| public boolean execute() Return true if the first result corresponds to a result set, and false if it is an update count or if there are no results other than through INOUT and OUT parameters, if any.
| |
| executeUpdate | back to summary |
|---|---|
| public int executeUpdate() Redeclares jakarta. Return the update count of -1 if there is no pending result or
if the first result is not an update count. The provider will
call
| |
| getOutputParameterValue | back to summary |
|---|---|
| public Object getOutputParameterValue(int position) Retrieve a value passed back from the procedure through an INOUT or OUT parameter. For portability, all results corresponding to result sets and update counts must be retrieved before the values of output parameters.
| |
| getOutputParameterValue | back to summary |
|---|---|
| public Object getOutputParameterValue(String parameterName) Retrieve a value passed back from the procedure through an INOUT or OUT parameter. For portability, all results corresponding to result sets and update counts must be retrieved before the values of output parameters.
| |
| getResultList | back to summary |
|---|---|
| public List Redeclares jakarta. Retrieve the list of results from the next result set.
The provider will call
| |
| getSingleResult | back to summary |
|---|---|
| public Object getSingleResult() Redeclares jakarta. Retrieve a single result from the next result set.
The provider will call
| |
| getSingleResultOrNull | back to summary |
|---|---|
| public Object getSingleResultOrNull() Redeclares jakarta. Retrieve a single result from the next result set.
The provider will call
| |
| getUpdateCount | back to summary |
|---|---|
| public int getUpdateCount() Return the update count or -1 if there is no pending result or if the next result is not an update count.
| |
| hasMoreResults | back to summary |
|---|---|
| public boolean hasMoreResults() Return true if the next result corresponds to a result set, and false if it is an update count or if there are no results other than through INOUT and OUT parameters, if any.
| |
| registerStoredProcedureParameter | back to summary |
|---|---|
| public StoredProcedureQuery registerStoredProcedureParameter(int position, Class<?> type, ParameterMode mode) Register a positional parameter. All parameters must be registered.
| |
| registerStoredProcedureParameter | back to summary |
|---|---|
| public StoredProcedureQuery registerStoredProcedureParameter(String parameterName, Class<?> type, ParameterMode mode) Register a named parameter.
| |
| setCacheRetrieveMode | back to summary |
|---|---|
| public StoredProcedureQuery setCacheRetrieveMode(CacheRetrieveMode cacheRetrieveMode) Redeclares jakarta. Set the cache retrieval mode that is in effect during query execution. This cache retrieval mode overrides the cache retrieve mode in use by the entity manager.
| |
| setCacheStoreMode | back to summary |
|---|---|
| public StoredProcedureQuery setCacheStoreMode(CacheStoreMode cacheStoreMode) Redeclares jakarta. Set the cache storage mode that is in effect during query execution. This cache storage mode overrides the cache storage mode in use by the entity manager.
| |
| setFlushMode | back to summary |
|---|---|
| public StoredProcedureQuery setFlushMode(FlushModeType flushMode) Redeclares jakarta. Set the flush mode type to be used for the query execution. The flush mode type applies to the query regardless of the flush mode type in use for the entity manager.
| |
| setHint | back to summary |
|---|---|
| public StoredProcedureQuery setHint(String hintName, Object value) Redeclares jakarta. Set a query property or hint. The hints elements may be used to specify query properties and hints. Properties defined by this specification must be observed by the provider. Vendor-specific hints that are not recognized by a provider must be silently ignored. Portable applications should not rely on the standard timeout hint. Depending on the database in use, this hint may or may not be observed.
| |
| setParameter | back to summary |
|---|---|
| public <T> StoredProcedureQuery setParameter(Parameter<T> param, T value) Redeclares jakarta. Bind the value of a
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) Redeclares jakarta. Bind an instance of
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(Parameter<Date> param, Date value, TemporalType temporalType) Redeclares jakarta. Bind an instance of
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(String name, Object value) Redeclares jakarta. Bind an argument value to a named parameter.
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(String name, Calendar value, TemporalType temporalType) Redeclares jakarta. Bind an instance of
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(String name, Date value, TemporalType temporalType) Redeclares jakarta. Bind an instance of
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(int position, Object value) Redeclares jakarta. Bind an argument value to a positional parameter.
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(int position, Calendar value, TemporalType temporalType) Redeclares jakarta. Bind an instance of
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(int position, Date value, TemporalType temporalType) Redeclares jakarta. Bind an instance of
| |
| setTimeout | back to summary |
|---|---|
| public StoredProcedureQuery setTimeout(Integer timeout) Redeclares jakarta. Set the query timeout, in milliseconds. This is a hint,
and is an alternative to setting
the hint
| |