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
will call 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 will be 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 javax. |
| 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 javax. |
| public Object | Returns: the result or null if the next item is not a result setRedeclares javax. |
| 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<T> 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<T> type of the parameter type, ParameterMode parameter mode mode)Register a named parameter. |
| public StoredProcedureQuery | Returns: the same query instanceflush mode flushMode)Redeclares javax. |
| public StoredProcedureQuery | Returns: the same query instancename of the property or hint hintName, Object value for the property or hint value)Redeclares javax. |
| public <T> StoredProcedureQuery | Returns: the same query instanceparameter object param, T parameter value value)Redeclares javax. Parameter object.
|
| public StoredProcedureQuery | Returns: the same query instanceparameter object param, Calendar parameter value value, TemporalType temporal type temporalType)Redeclares javax. java.util.Calendar to a Parameter object.
|
| public StoredProcedureQuery | Returns: the same query instanceparameter object param, Date parameter value value, TemporalType temporal type temporalType)Redeclares javax. java.util.Date to a Parameter object.
|
| public StoredProcedureQuery | Returns: the same query instanceparameter name name, Object parameter value value)Redeclares javax. |
| public StoredProcedureQuery | Returns: the same query instanceparameter name name, Calendar parameter value value, TemporalType temporal type temporalType)Redeclares javax. java.util.Calendar to a named parameter.
|
| public StoredProcedureQuery | Returns: the same query instanceparameter name name, Date parameter value value, TemporalType temporal type temporalType)Redeclares javax. java.util.Date to a named parameter.
|
| public StoredProcedureQuery | Returns: the same query instanceposition position, Object parameter value value)Redeclares javax. |
| public StoredProcedureQuery | Returns: the same query instanceposition position, Calendar parameter value value, TemporalType temporal type temporalType)Redeclares javax. java.util.Calendar to a positional
parameter.
|
| public StoredProcedureQuery | Returns: the same query instanceposition position, Date parameter value value, TemporalType temporal type temporalType)Redeclares javax. java.util.Date to a positional parameter.
|
| 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 javax. 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 javax. Retrieve the list of results from the next result set.
The provider will call
| |
| getSingleResult | back to summary |
|---|---|
| public Object getSingleResult() Redeclares javax. 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<T> type, ParameterMode mode) Register a positional parameter. All parameters must be registered.
| |
| registerStoredProcedureParameter | back to summary |
|---|---|
| public StoredProcedureQuery registerStoredProcedureParameter(String parameterName, Class<T> type, ParameterMode mode) Register a named parameter.
| |
| setFlushMode | back to summary |
|---|---|
| public StoredProcedureQuery setFlushMode(FlushModeType flushMode) Redeclares javax. 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 javax. 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 javax. Bind the value of a
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType) Redeclares javax. Bind an instance of
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(Parameter<Date> param, Date value, TemporalType temporalType) Redeclares javax. Bind an instance of
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(String name, Object value) Redeclares javax. Bind an argument value to a named parameter.
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(String name, Calendar value, TemporalType temporalType) Redeclares javax. Bind an instance of
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(String name, Date value, TemporalType temporalType) Redeclares javax. Bind an instance of
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(int position, Object value) Redeclares javax. Bind an argument value to a positional parameter.
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(int position, Calendar value, TemporalType temporalType) Redeclares javax. Bind an instance of
| |
| setParameter | back to summary |
|---|---|
| public StoredProcedureQuery setParameter(int position, Date value, TemporalType temporalType) Redeclares javax. Bind an instance of
| |