|
EclipseLink 2.5.0, build 'v20130507-3faac2b' API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface StoredProcedureQuery
Interface used to control stored procedure query execution.
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| Method Summary | ||
|---|---|---|
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. |
|
int |
executeUpdate()
Return the update count of -1 if there is no pending result or if the first result is not an update count. |
|
java.lang.Object |
getOutputParameterValue(int position)
Retrieve a value passed back from the procedure through an INOUT or OUT parameter. |
|
java.lang.Object |
getOutputParameterValue(java.lang.String parameterName)
Retrieve a value passed back from the procedure through an INOUT or OUT parameter. |
|
java.util.List |
getResultList()
Retrieve the list of results from the next result set. |
|
java.lang.Object |
getSingleResult()
Retrieve a single result from the next result set. |
|
int |
getUpdateCount()
Return the update count or -1 if there is no pending result or if the next result is not an update count. |
|
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. |
|
StoredProcedureQuery |
registerStoredProcedureParameter(int position,
java.lang.Class type,
ParameterMode mode)
Register a positional parameter. |
|
StoredProcedureQuery |
registerStoredProcedureParameter(java.lang.String parameterName,
java.lang.Class type,
ParameterMode mode)
Register a named parameter. |
|
StoredProcedureQuery |
setFlushMode(FlushModeType flushMode)
Set the flush mode type to be used for the query execution. |
|
StoredProcedureQuery |
setHint(java.lang.String hintName,
java.lang.Object value)
Set a query property or hint. |
|
StoredProcedureQuery |
setParameter(int position,
java.util.Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a positional
parameter. |
|
StoredProcedureQuery |
setParameter(int position,
java.util.Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a positional parameter. |
|
StoredProcedureQuery |
setParameter(int position,
java.lang.Object value)
Bind an argument value to a positional parameter. |
|
StoredProcedureQuery |
setParameter(Parameter<java.util.Calendar> param,
java.util.Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a Parameter object. |
|
StoredProcedureQuery |
setParameter(Parameter<java.util.Date> param,
java.util.Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a Parameter object. |
|
|
setParameter(Parameter<T> param,
T value)
Bind the value of a Parameter object. |
|
StoredProcedureQuery |
setParameter(java.lang.String name,
java.util.Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a named parameter. |
|
StoredProcedureQuery |
setParameter(java.lang.String name,
java.util.Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a named parameter. |
|
StoredProcedureQuery |
setParameter(java.lang.String name,
java.lang.Object value)
Bind an argument value to a named parameter. |
|
| Methods inherited from interface javax.persistence.Query |
|---|
getFirstResult, getFlushMode, getHints, getLockMode, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, setFirstResult, setLockMode, setMaxResults, unwrap |
| Method Detail |
|---|
StoredProcedureQuery setHint(java.lang.String hintName,
java.lang.Object value)
setHint in interface QueryhintName - name of the property or hintvalue - value for the property or hint
java.lang.IllegalArgumentException - if the second argument is not
valid for the implementation
<T> StoredProcedureQuery setParameter(Parameter<T> param,
T value)
Parameter object.
setParameter in interface Queryparam - parameter objectvalue - parameter value
java.lang.IllegalArgumentException - if the parameter does not
correspond to a parameter of the query
StoredProcedureQuery setParameter(Parameter<java.util.Calendar> param,
java.util.Calendar value,
TemporalType temporalType)
java.util.Calendar to a Parameter object.
setParameter in interface Queryparam - parameter objectvalue - parameter valuetemporalType - temporal type
java.lang.IllegalArgumentException - if the parameter does not
correspond to a parameter of the query
StoredProcedureQuery setParameter(Parameter<java.util.Date> param,
java.util.Date value,
TemporalType temporalType)
java.util.Date to a Parameter object.
setParameter in interface Queryparam - parameter objectvalue - parameter valuetemporalType - temporal type
java.lang.IllegalArgumentException - if the parameter does not
correspond to a parameter of the query
StoredProcedureQuery setParameter(java.lang.String name,
java.lang.Object value)
setParameter in interface Queryname - parameter namevalue - parameter value
java.lang.IllegalArgumentException - if the parameter name does
not correspond to a parameter of the query or if the
argument is of incorrect type
StoredProcedureQuery setParameter(java.lang.String name,
java.util.Calendar value,
TemporalType temporalType)
java.util.Calendar to a named parameter.
setParameter in interface Queryname - parameter namevalue - parameter valuetemporalType - temporal type
java.lang.IllegalArgumentException - if the parameter name does
not correspond to a parameter of the query or if the
value argument is of incorrect type
StoredProcedureQuery setParameter(java.lang.String name,
java.util.Date value,
TemporalType temporalType)
java.util.Date to a named parameter.
setParameter in interface Queryname - parameter namevalue - parameter valuetemporalType - temporal type
java.lang.IllegalArgumentException - if the parameter name does
not correspond to a parameter of the query or if the
value argument is of incorrect type
StoredProcedureQuery setParameter(int position,
java.lang.Object value)
setParameter in interface Queryposition - positionvalue - parameter value
java.lang.IllegalArgumentException - if position does not
correspond to a positional parameter of the query
or if the argument is of incorrect type
StoredProcedureQuery setParameter(int position,
java.util.Calendar value,
TemporalType temporalType)
java.util.Calendar to a positional
parameter.
setParameter in interface Queryposition - positionvalue - parameter valuetemporalType - temporal type
java.lang.IllegalArgumentException - if position does not
correspond to a positional parameter of the query or
if the value argument is of incorrect type
StoredProcedureQuery setParameter(int position,
java.util.Date value,
TemporalType temporalType)
java.util.Date to a positional parameter.
setParameter in interface Queryposition - positionvalue - parameter valuetemporalType - temporal type
java.lang.IllegalArgumentException - if position does not
correspond to a positional parameter of the query or
if the value argument is of incorrect typeStoredProcedureQuery setFlushMode(FlushModeType flushMode)
setFlushMode in interface QueryflushMode - flush mode
StoredProcedureQuery registerStoredProcedureParameter(int position,
java.lang.Class type,
ParameterMode mode)
position - parameter positiontype - type of the parametermode - parameter mode
StoredProcedureQuery registerStoredProcedureParameter(java.lang.String parameterName,
java.lang.Class type,
ParameterMode mode)
parameterName - name of the parameter as registered or
specified in metadatatype - type of the parametermode - parameter mode
java.lang.Object getOutputParameterValue(int position)
position - parameter position
java.lang.IllegalArgumentException - if the position does
not correspond to a parameter of the query or is
not an INOUT or OUT parameterjava.lang.Object getOutputParameterValue(java.lang.String parameterName)
parameterName - name of the parameter as registered or
specified in metadata
java.lang.IllegalArgumentException - if the parameter name does
not correspond to a parameter of the query or is
not an INOUT or OUT parameterboolean execute()
QueryTimeoutException - if the query execution exceeds
the query timeout value set and only the statement is
rolled back
PersistenceException - if the query execution exceeds
the query timeout value set and the transaction
is rolled backint executeUpdate()
execute on the query if needed.
executeUpdate in interface QueryTransactionRequiredException - if there is
no transaction or the persistence context has not
been joined to the transaction
QueryTimeoutException - if the statement execution
exceeds the query timeout value set and only
the statement is rolled back
PersistenceException - if the query execution exceeds
the query timeout value set and the transaction
is rolled backjava.util.List getResultList()
execute on the query
if needed.
A REF_CURSOR result set, if any, will be retrieved
in the order the REF_CURSOR parameter was
registered with the query.
getResultList in interface QueryQueryTimeoutException - if the query execution exceeds
the query timeout value set and only the statement is
rolled back
PersistenceException - if the query execution exceeds
the query timeout value set and the transaction
is rolled backjava.lang.Object getSingleResult()
execute on the query
if needed.
A REF_CURSOR result set, if any, will be retrieved
in the order the REF_CURSOR parameter was
registered with the query.
getSingleResult in interface QueryNoResultException - if there is no result in the next
result set
NonUniqueResultException - if more than one result
QueryTimeoutException - if the query execution exceeds
the query timeout value set and only the statement is
rolled back
PersistenceException - if the query execution exceeds
the query timeout value set and the transaction
is rolled backboolean hasMoreResults()
QueryTimeoutException - if the query execution exceeds
the query timeout value set and only the statement is
rolled back
PersistenceException - if the query execution exceeds
the query timeout value set and the transaction
is rolled backint getUpdateCount()
QueryTimeoutException - if the query execution exceeds
the query timeout value set and only the statement is
rolled back
PersistenceException - if the query execution exceeds
the query timeout value set and the transaction
is rolled back
|
EclipseLink 2.5.0, build 'v20130507-3faac2b' API Reference | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||