public class StoredProcedureQueryImpl extends BaseQueryImpl implements StoredProcedureQuery
BaseQueryImpl.ParameterBindImpl<T>
Constructor and Description |
---|
StoredProcedureQueryImpl(ProcedureCall procedureCall,
HibernateEntityManagerImplementor entityManager) |
StoredProcedureQueryImpl(ProcedureCallMemento memento,
HibernateEntityManagerImplementor entityManager)
This form is used to build a StoredProcedureQueryImpl from a memento (usually from a NamedStoredProcedureQuery).
|
Modifier and Type | Method and Description |
---|---|
protected void |
applyAliasSpecificLockModeHint(String alias,
LockMode lockMode)
Apply the alias specific lock modes.
|
protected boolean |
applyCacheableHint(boolean isCacheable)
Apply the cacheable (true/false) hint.
|
protected boolean |
applyCacheModeHint(CacheMode cacheMode)
Apply the CacheMode hint.
|
protected boolean |
applyCacheRegionHint(String regionName)
Apply the cache region hint
|
protected boolean |
applyCommentHint(String comment)
Apply the comment hint.
|
protected boolean |
applyFetchSizeHint(int fetchSize)
Apply the fetch size hint
|
protected void |
applyFirstResult(int firstResult)
Apply the given first-result value.
|
protected boolean |
applyFlushModeHint(FlushMode flushMode)
Apply the FlushMode hint.
|
protected boolean |
applyLockTimeoutHint(int timeout)
Apply the lock timeout (in seconds!) hint
|
protected void |
applyMaxResults(int maxResults)
Apply the given max results value.
|
protected boolean |
applyReadOnlyHint(boolean isReadOnly)
Apply the read-only (true/false) hint.
|
protected boolean |
applyTimeoutHint(int timeout)
Apply the query timeout hint.
|
protected boolean |
canApplyAliasSpecificLockModeHints()
Can alias-specific lock modes be applied?
|
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()
Execute an update or delete statement.
|
ProcedureCall |
getHibernateProcedureCall() |
LockModeType |
getLockMode()
Get the current lock mode for the query.
|
Object |
getOutputParameterValue(int position)
Retrieve a value passed back from the procedure through an
INOUT or OUT parameter.
|
Object |
getOutputParameterValue(String parameterName)
Retrieve a value passed back from the procedure through an
INOUT or OUT parameter.
|
List |
getResultList()
Execute a SELECT query and return the query results
as an untyped List.
|
Object |
getSingleResult()
Execute a SELECT query that returns a single untyped result.
|
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.
|
protected void |
internalApplyLockMode(LockModeType lockModeType) |
protected boolean |
isNativeSqlQuery()
Is the query represented here a native SQL query?
|
protected boolean |
isSelectQuery()
Is the query represented here a SELECT query?
|
protected ProcedureOutputs |
outputs() |
StoredProcedureQuery |
registerStoredProcedureParameter(int position,
Class type,
ParameterMode mode)
Register a positional parameter.
|
StoredProcedureQuery |
registerStoredProcedureParameter(String parameterName,
Class type,
ParameterMode mode)
Register a named parameter.
|
StoredProcedureQueryImpl |
setFlushMode(FlushModeType jpaFlushMode)
Set the flush mode type to be used for the query execution.
|
StoredProcedureQueryImpl |
setHint(String hintName,
Object value)
Set a query property or hint.
|
Query |
setLockMode(LockModeType lockMode)
Set the lock mode type to be used for the query execution.
|
StoredProcedureQueryImpl |
setParameter(int position,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a positional
parameter. |
StoredProcedureQueryImpl |
setParameter(int position,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a positional parameter. |
StoredProcedureQueryImpl |
setParameter(int position,
Object value)
Bind an argument to a positional parameter.
|
StoredProcedureQueryImpl |
setParameter(Parameter<Calendar> param,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a Parameter object. |
StoredProcedureQueryImpl |
setParameter(Parameter<Date> param,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a Parameter object. |
<T> StoredProcedureQueryImpl |
setParameter(Parameter<T> param,
T value)
Bind the value of a
Parameter object. |
StoredProcedureQueryImpl |
setParameter(String name,
Calendar value,
TemporalType temporalType)
Bind an instance of
java.util.Calendar to a named parameter. |
StoredProcedureQueryImpl |
setParameter(String name,
Date value,
TemporalType temporalType)
Bind an instance of
java.util.Date to a named parameter. |
StoredProcedureQueryImpl |
setParameter(String name,
Object value)
Bind an argument to a named parameter.
|
<T> T |
unwrap(Class<T> cls)
Return an object of the specified type to allow access to
the provider-specific API.
|
checkOpen, entityManager, findParameterRegistration, findParameterRegistration, findParameterRegistration, getEntityGraphQueryHint, getFirstResult, getFlushMode, getHints, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, getSpecifiedFlushMode, getSpecifiedMaxResults, getSupportedHints, isBound, registerParameter, setFirstResult, setMaxResults, validateBinding
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFirstResult, getFlushMode, getHints, getMaxResults, getParameter, getParameter, getParameter, getParameter, getParameters, getParameterValue, getParameterValue, getParameterValue, isBound, setFirstResult, setMaxResults
public StoredProcedureQueryImpl(ProcedureCall procedureCall, HibernateEntityManagerImplementor entityManager)
public StoredProcedureQueryImpl(ProcedureCallMemento memento, HibernateEntityManagerImplementor entityManager)
memento
- The mementoentityManager
- The EntityManagerprotected boolean applyTimeoutHint(int timeout)
BaseQueryImpl
applyTimeoutHint
in class BaseQueryImpl
timeout
- The timeout (in seconds!) specified as a hinttrue
if the hint was "applied"protected boolean applyCacheableHint(boolean isCacheable)
BaseQueryImpl
applyCacheableHint
in class BaseQueryImpl
isCacheable
- The value specified as hinttrue
if the hint was "applied"protected boolean applyCacheRegionHint(String regionName)
BaseQueryImpl
applyCacheRegionHint
in class BaseQueryImpl
regionName
- The name of the cache region specified as a hinttrue
if the hint was "applied"protected boolean applyReadOnlyHint(boolean isReadOnly)
BaseQueryImpl
applyReadOnlyHint
in class BaseQueryImpl
isReadOnly
- The value specified as hinttrue
if the hint was "applied"protected boolean applyCacheModeHint(CacheMode cacheMode)
BaseQueryImpl
applyCacheModeHint
in class BaseQueryImpl
cacheMode
- The CacheMode value specified as a hint.true
if the hint was "applied"protected boolean applyFlushModeHint(FlushMode flushMode)
BaseQueryImpl
applyFlushModeHint
in class BaseQueryImpl
flushMode
- The FlushMode value specified as hinttrue
if the hint was "applied"public StoredProcedureQuery registerStoredProcedureParameter(int position, Class type, ParameterMode mode)
StoredProcedureQuery
registerStoredProcedureParameter
in interface StoredProcedureQuery
position
- parameter positiontype
- type of the parametermode
- parameter modepublic StoredProcedureQuery registerStoredProcedureParameter(String parameterName, Class type, ParameterMode mode)
StoredProcedureQuery
registerStoredProcedureParameter
in interface StoredProcedureQuery
parameterName
- name of the parameter as registered or
specified in metadatatype
- type of the parametermode
- parameter modepublic <T> StoredProcedureQueryImpl setParameter(Parameter<T> param, T value)
Query
Parameter
object.setParameter
in interface Query
setParameter
in interface StoredProcedureQuery
setParameter
in class BaseQueryImpl
param
- parameter objectvalue
- parameter valuepublic StoredProcedureQueryImpl setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
Query
java.util.Calendar
to a Parameter
object.setParameter
in interface Query
setParameter
in interface StoredProcedureQuery
setParameter
in class BaseQueryImpl
param
- parameter objectvalue
- parameter valuetemporalType
- temporal typepublic StoredProcedureQueryImpl setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
Query
java.util.Date
to a Parameter
object.setParameter
in interface Query
setParameter
in interface StoredProcedureQuery
setParameter
in class BaseQueryImpl
param
- parameter objectvalue
- parameter valuetemporalType
- temporal typepublic StoredProcedureQueryImpl setParameter(String name, Object value)
Query
setParameter
in interface Query
setParameter
in interface StoredProcedureQuery
setParameter
in class BaseQueryImpl
name
- parameter namevalue
- parameter valuepublic StoredProcedureQueryImpl setParameter(String name, Calendar value, TemporalType temporalType)
Query
java.util.Calendar
to a named parameter.setParameter
in interface Query
setParameter
in interface StoredProcedureQuery
setParameter
in class BaseQueryImpl
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic StoredProcedureQueryImpl setParameter(String name, Date value, TemporalType temporalType)
Query
java.util.Date
to a named parameter.setParameter
in interface Query
setParameter
in interface StoredProcedureQuery
setParameter
in class BaseQueryImpl
name
- parameter namevalue
- parameter valuetemporalType
- temporal typepublic StoredProcedureQueryImpl setParameter(int position, Object value)
Query
setParameter
in interface Query
setParameter
in interface StoredProcedureQuery
setParameter
in class BaseQueryImpl
position
- positionvalue
- parameter valuepublic StoredProcedureQueryImpl setParameter(int position, Calendar value, TemporalType temporalType)
Query
java.util.Calendar
to a positional
parameter.setParameter
in interface Query
setParameter
in interface StoredProcedureQuery
setParameter
in class BaseQueryImpl
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic StoredProcedureQueryImpl setParameter(int position, Date value, TemporalType temporalType)
Query
java.util.Date
to a positional parameter.setParameter
in interface Query
setParameter
in interface StoredProcedureQuery
setParameter
in class BaseQueryImpl
position
- positionvalue
- parameter valuetemporalType
- temporal typepublic StoredProcedureQueryImpl setFlushMode(FlushModeType jpaFlushMode)
Query
setFlushMode
in interface Query
setFlushMode
in interface StoredProcedureQuery
setFlushMode
in class BaseQueryImpl
jpaFlushMode
- flush modepublic StoredProcedureQueryImpl setHint(String hintName, Object value)
Query
setHint
in interface Query
setHint
in interface StoredProcedureQuery
setHint
in class BaseQueryImpl
hintName
- name of the property or hintvalue
- value for the property or hintpublic boolean execute()
StoredProcedureQuery
execute
in interface StoredProcedureQuery
protected ProcedureOutputs outputs()
public int executeUpdate()
Query
executeUpdate
in interface Query
public Object getOutputParameterValue(int position)
StoredProcedureQuery
getOutputParameterValue
in interface StoredProcedureQuery
position
- parameter positionpublic Object getOutputParameterValue(String parameterName)
StoredProcedureQuery
getOutputParameterValue
in interface StoredProcedureQuery
parameterName
- name of the parameter as registered or
specified in metadatapublic boolean hasMoreResults()
StoredProcedureQuery
hasMoreResults
in interface StoredProcedureQuery
public int getUpdateCount()
StoredProcedureQuery
getUpdateCount
in interface StoredProcedureQuery
public List getResultList()
Query
getResultList
in interface Query
public Object getSingleResult()
Query
getSingleResult
in interface Query
public <T> T unwrap(Class<T> cls)
Query
PersistenceException
is thrown.protected boolean isNativeSqlQuery()
BaseQueryImpl
isNativeSqlQuery
in class BaseQueryImpl
true
if it is a native SQL query; false
otherwiseprotected boolean isSelectQuery()
BaseQueryImpl
isSelectQuery
in class BaseQueryImpl
true
if the query is a SELECT; false
otherwise.public Query setLockMode(LockModeType lockMode)
Query
setLockMode
in interface Query
lockMode
- lock modepublic LockModeType getLockMode()
Query
getLockMode
in interface Query
protected void internalApplyLockMode(LockModeType lockModeType)
internalApplyLockMode
in class BaseQueryImpl
protected void applyFirstResult(int firstResult)
BaseQueryImpl
applyFirstResult
in class BaseQueryImpl
firstResult
- The specified first-result value.protected void applyMaxResults(int maxResults)
BaseQueryImpl
applyMaxResults
in class BaseQueryImpl
maxResults
- The specified max resultsprotected boolean canApplyAliasSpecificLockModeHints()
BaseQueryImpl
canApplyAliasSpecificLockModeHints
in class BaseQueryImpl
true
indicates they can be applied, false
otherwise.protected void applyAliasSpecificLockModeHint(String alias, LockMode lockMode)
BaseQueryImpl
BaseQueryImpl.canApplyAliasSpecificLockModeHints()
has already been
called and returned true
.applyAliasSpecificLockModeHint
in class BaseQueryImpl
alias
- The alias to apply the 'lockMode' to.lockMode
- The LockMode to apply.protected boolean applyLockTimeoutHint(int timeout)
BaseQueryImpl
applyLockTimeoutHint
in class BaseQueryImpl
timeout
- The timeout (in seconds!) specified as a hinttrue
if the hint was "applied"protected boolean applyCommentHint(String comment)
BaseQueryImpl
applyCommentHint
in class BaseQueryImpl
comment
- The comment specified as a hinttrue
if the hint was "applied"protected boolean applyFetchSizeHint(int fetchSize)
BaseQueryImpl
applyFetchSizeHint
in class BaseQueryImpl
fetchSize
- The fetch size specified as a hinttrue
if the hint was "applied"public ProcedureCall getHibernateProcedureCall()
Copyright © 2017 JBoss by Red Hat. All rights reserved.