public class StoredProcedureQueryImpl extends QueryImpl
| Modifier and Type | Field and Description |
|---|---|
protected DatabaseCall |
executeCall |
protected int |
executeResultSetIndex |
protected java.sql.Statement |
executeStatement |
protected boolean |
hasMoreResults |
protected boolean |
isOutputCursorResultSet |
protected int |
outputCursorIndex |
databaseQuery, entityManager, firstResultIndex, isShared, lockMode, maxResults, parameters, parameterValues, queryName, UNDEFINED| Modifier | Constructor and Description |
|---|---|
|
StoredProcedureQueryImpl(DatabaseQuery query,
EntityManagerImpl entityManager)
Create an StoredProcedureQueryImpl with a DatabaseQuery.
|
protected |
StoredProcedureQueryImpl(EntityManagerImpl entityManager)
Base constructor for StoredProcedureQueryImpl.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.util.List |
buildResultRecords(java.sql.ResultSet resultSet)
Build the given result set into a list objects.
|
static DatabaseQuery |
buildResultSetMappingNameQuery(java.util.List<java.lang.String> resultSetMappingNames,
StoredProcedureCall call)
Build a ResultSetMappingQuery from a sql result set mapping name and a
stored procedure call.
|
static DatabaseQuery |
buildResultSetMappingNameQuery(java.util.List<java.lang.String> resultSetMappingNames,
StoredProcedureCall call,
java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.ClassLoader classLoader,
AbstractSession session)
Build a ResultSetMappingQuery from a sql result set mapping name and a
stored procedure call.
|
static DatabaseQuery |
buildResultSetMappingQuery(java.util.List<SQLResultSetMapping> resultSetMappings,
StoredProcedureCall call)
Build a ResultSetMappingQuery from the sql result set mappings given
a stored procedure call.
|
static DatabaseQuery |
buildResultSetMappingQuery(java.util.List<SQLResultSetMapping> resultSetMappings,
StoredProcedureCall call,
java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.ClassLoader classLoader,
AbstractSession session)
Build a ResultSetMappingQuery from the sql result set mappings given
a stored procedure call.
|
static DatabaseQuery |
buildStoredProcedureQuery(java.lang.Class resultClass,
StoredProcedureCall call,
java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.ClassLoader classLoader,
AbstractSession session)
Build a ReadAllQuery from a class and stored procedure call.
|
static DatabaseQuery |
buildStoredProcedureQuery(StoredProcedureCall call,
java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.ClassLoader classLoader,
AbstractSession session)
Build a DataReadQuery with the stored procedure call given.
|
static DatabaseQuery |
buildStoredProcedureQuery(java.lang.String sqlResultSetMappingName,
StoredProcedureCall call,
java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.ClassLoader classLoader,
AbstractSession session)
Build a ResultSetMappingQuery from a sql result set mapping name and a
stored procedure call.
|
void |
close()
Call this method to close any open connections to the database.
|
boolean |
execute()
Returns 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()
Execute an update or delete statement (from a stored procedure query).
|
void |
finalize()
Finalize method in case the query is not closed.
|
protected StoredProcedureCall |
getCall()
Return the stored procedure call associated with this query.
|
protected java.util.Map<java.lang.String,<any>> |
getInternalParameters()
Return the internal map of parameters.
|
java.lang.Object |
getOutputParameterValue(int position)
Used to retrieve the values passed back from the procedure through INOUT
and OUT parameters.
|
java.lang.Object |
getOutputParameterValue(java.lang.String parameterName)
Used to retrieve the values passed back from the procedure through INOUT
and OUT parameters.
|
java.util.List |
getResultList()
Execute the query and return the query results as a List.
|
protected ResultSetMappingQuery |
getResultSetMappingQuery()
Return the ResultSetMappingQuery for this stored procedure query.
|
java.lang.Object |
getSingleResult()
Execute the query and return the single query result.
|
int |
getUpdateCount()
Returns the update count or -1 if there is no pending result
or if the next result is not an update count.
|
boolean |
hasMoreResults()
Returns 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.
|
protected boolean |
isValidCallableStatement()
Returns true if the execute statement for this query is 1) not null (i.e.
|
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.
|
StoredProcedureQueryImpl |
setFirstResult(int startPosition)
Set the position of the first result to retrieve.
|
StoredProcedureQueryImpl |
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.
|
StoredProcedureQueryImpl |
setLockMode(LockModeType lockMode)
Set the lock mode type to be used for the query execution.
|
StoredProcedureQueryImpl |
setMaxResults(int maxResult)
Set the maximum number of results to retrieve.
|
StoredProcedureQuery |
setParameter(<any> param,
java.util.Calendar value,
TemporalType temporalType)
Bind an instance of java.util.Calendar to a Parameter object.
|
StoredProcedureQuery |
setParameter(<any> param,
java.util.Date value,
TemporalType temporalType)
Bind an instance of java.util.Date to a Parameter object.
|
<T> StoredProcedureQuery |
setParameter(<any> param,
T value)
Bind the value of a Parameter object.
|
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 to a positional parameter.
|
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 to a named parameter.
|
protected void |
setParameterInternal(java.lang.String name,
java.lang.Object value,
boolean isIndex)
Bind an argument to a named or indexed parameter.
|
applyArguments, applyHints, cloneSharedQuery, convertTemporalType, executeReadQuery, getActiveSession, getDatabaseQuery, getDatabaseQueryInternal, getDetailedException, getEntityManager, getFirstResult, getFlushMode, getHints, getLockMode, getMaxResults, getMaxResultsInternal, getParameter, getParameter, getParameter, getParameter, getParameterId, getParameters, getParameterValue, getParameterValue, getParameterValue, getSupportedHints, isBound, isFlushModeAUTO, isValidActualParameter, performPreQueryFlush, processParameters, propagateResultProperties, setAsDataModifyQuery, setAsSQLModifyQuery, setAsSQLReadQuery, setDatabaseQuery, setFirstResultInternal, setHintInternal, setMaxResultsInternal, setParameterInternal, setRollbackOnly, throwNonUniqueResultException, throwNoResultException, toString, unwrapprotected boolean hasMoreResults
protected DatabaseCall executeCall
protected java.sql.Statement executeStatement
protected int executeResultSetIndex
protected int outputCursorIndex
protected boolean isOutputCursorResultSet
protected StoredProcedureQueryImpl(EntityManagerImpl entityManager)
public StoredProcedureQueryImpl(DatabaseQuery query,
EntityManagerImpl entityManager)
protected java.util.List buildResultRecords(java.sql.ResultSet resultSet)
public static DatabaseQuery buildResultSetMappingNameQuery(java.util.List<java.lang.String> resultSetMappingNames,
StoredProcedureCall call)
public static DatabaseQuery buildResultSetMappingNameQuery(java.util.List<java.lang.String> resultSetMappingNames,
StoredProcedureCall call,
java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.ClassLoader classLoader,
AbstractSession session)
public static DatabaseQuery buildResultSetMappingQuery(java.util.List<SQLResultSetMapping> resultSetMappings,
StoredProcedureCall call)
public static DatabaseQuery buildResultSetMappingQuery(java.util.List<SQLResultSetMapping> resultSetMappings,
StoredProcedureCall call,
java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.ClassLoader classLoader,
AbstractSession session)
public static DatabaseQuery buildStoredProcedureQuery(java.lang.Class resultClass,
StoredProcedureCall call,
java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.ClassLoader classLoader,
AbstractSession session)
public static DatabaseQuery buildStoredProcedureQuery(StoredProcedureCall call,
java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.ClassLoader classLoader,
AbstractSession session)
public static DatabaseQuery buildStoredProcedureQuery(java.lang.String sqlResultSetMappingName,
StoredProcedureCall call,
java.util.Map<java.lang.String,java.lang.Object> hints,
java.lang.ClassLoader classLoader,
AbstractSession session)
public void close()
public boolean execute()
QueryTimeoutException - if the query execution exceeds the query
timeout value set and only the statement is rolled backPersistenceException - if the query execution exceeds the query
timeout value set and the transaction is rolled backpublic int executeUpdate()
executeUpdate in class QueryImplpublic void finalize()
finalize in class java.lang.Objectprotected StoredProcedureCall getCall()
protected java.util.Map<java.lang.String,<any>> getInternalParameters()
getInternalParameters in class QueryImplpublic java.lang.Object getOutputParameterValue(int position)
position - parameter positionjava.lang.IllegalArgumentException - if the position does not correspond to a
parameter of the query or is not an INOUT or OUT parameterpublic java.lang.Object getOutputParameterValue(java.lang.String parameterName)
parameterName - name of the parameter as registered or specified in
metadatajava.lang.IllegalArgumentException - if the parameter name does not
correspond to a parameter of the query or is not an INOUT or OUT parameterpublic java.util.List getResultList()
getResultList in class QueryImplprotected ResultSetMappingQuery getResultSetMappingQuery()
public java.lang.Object getSingleResult()
getSingleResult in class QueryImplpublic int getUpdateCount()
QueryTimeoutException - if the query execution exceeds
the query timeout value set and only the statement is
rolled backPersistenceException - if the query execution exceeds
the query timeout value set and the transaction
is rolled backpublic boolean hasMoreResults()
QueryTimeoutException - if the query execution exceeds the query
timeout value set and only the statement is rolled backPersistenceException - if the query execution exceeds the query
timeout value set and the transaction is rolled backprotected boolean isValidCallableStatement()
public StoredProcedureQuery registerStoredProcedureParameter(int position,
java.lang.Class type,
ParameterMode mode)
position - parameter positiontype - type of the parametermode - parameter modepublic 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 modepublic StoredProcedureQueryImpl setFirstResult(int startPosition)
setFirstResult in class QueryImplstartPosition - position of the first result, numbered from 0public StoredProcedureQueryImpl setFlushMode(FlushModeType flushMode)
setFlushMode in class QueryImplflushMode - flush modepublic StoredProcedureQuery setHint(java.lang.String hintName,
java.lang.Object value)
hintName - name of the property or hintvalue - value for the property or hintjava.lang.IllegalArgumentException - if the second argument is not valid for
the implementationpublic StoredProcedureQueryImpl setLockMode(LockModeType lockMode)
setLockMode in class QueryImpllockMode - java.lang.IllegalStateException - if not a Java Persistence query language SELECT querypublic StoredProcedureQueryImpl setMaxResults(int maxResult)
setMaxResults in class QueryImplmaxResult - public StoredProcedureQuery setParameter(int position,
java.util.Calendar value,
TemporalType temporalType)
position - value - temporalType - java.lang.IllegalArgumentException - if position does not correspond to a
positional parameter of the query or if the value argument is of
incorrect typepublic StoredProcedureQuery setParameter(int position,
java.util.Date value,
TemporalType temporalType)
position - value - temporalType - java.lang.IllegalArgumentException - if position does not correspond to a
positional parameter of the query or if the value argument is of
incorrect typepublic StoredProcedureQuery setParameter(int position,
java.lang.Object value)
position - value - java.lang.IllegalArgumentException - if position does not correspond to a
positional parameter of the query or if the argument is of incorrect typepublic StoredProcedureQuery setParameter(<any> param,
java.util.Calendar value,
TemporalType temporalType)
param - value - temporalType - java.lang.IllegalArgumentException - if the parameter does not correspond to
a parameter of the querypublic StoredProcedureQuery setParameter(<any> param,
java.util.Date value,
TemporalType temporalType)
param - value - temporalType - java.lang.IllegalArgumentException - if the parameter does not correspond to
a parameter of the querypublic <T> StoredProcedureQuery setParameter(<any> param,
T value)
param - value - java.lang.IllegalArgumentException - if the parameter does not correspond to
a parameter of the querypublic StoredProcedureQuery setParameter(java.lang.String name,
java.util.Calendar value,
TemporalType temporalType)
name - value - temporalType - java.lang.IllegalArgumentException - if the parameter name does not
correspond to a parameter of the query or if the value argument is of
incorrect typepublic StoredProcedureQuery setParameter(java.lang.String name,
java.util.Date value,
TemporalType temporalType)
name - value - temporalType - java.lang.IllegalArgumentException - if the parameter name does not
correspond to a parameter of the query or if the value argument is of
incorrect typepublic StoredProcedureQuery setParameter(java.lang.String name,
java.lang.Object value)
name - value - java.lang.IllegalArgumentException - if the parameter name does not
correspond to a parameter of the query or if the argument is of incorrect
typeprotected void setParameterInternal(java.lang.String name,
java.lang.Object value,
boolean isIndex)
setParameterInternal in class QueryImplname - the parameter namevalue - to bindisIndex - defines if index or named