Package org.hibernate.engine.spi
Class QueryParameters
- java.lang.Object
-
- org.hibernate.engine.spi.QueryParameters
-
public final class QueryParameters extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description QueryParameters()
QueryParameters(QueryParameterBindings queryParameterBindings, LockOptions lockOptions, RowSelection selection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, java.lang.String cacheRegion, java.lang.String comment, java.util.List<java.lang.String> dbHints, java.io.Serializable[] collectionKeys, java.lang.Object optionalObject, java.lang.String optionalEntityName, java.io.Serializable optionalId, ResultTransformer resultTransformer)
QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues)
QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, java.io.Serializable[] collectionKeys)
QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, java.lang.Object optionalObject, java.lang.String optionalEntityName, java.io.Serializable optionalObjectId)
QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, java.util.Map<java.lang.String,TypedValue> namedParameters, java.io.Serializable[] collectionKeys)
QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, java.util.Map<java.lang.String,TypedValue> namedParameters, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, java.lang.String cacheRegion, java.lang.String comment, java.util.List<java.lang.String> queryHints, java.io.Serializable[] collectionKeys, java.lang.Object optionalObject, java.lang.String optionalEntityName, java.io.Serializable optionalId, ResultTransformer transformer)
QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, java.util.Map<java.lang.String,TypedValue> namedParameters, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, java.lang.String cacheRegion, java.lang.String comment, java.util.List<java.lang.String> queryHints, java.io.Serializable[] collectionKeys, ResultTransformer transformer)
QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, java.lang.String cacheRegion, java.lang.String comment, java.util.List<java.lang.String> queryHints, boolean isLookupByNaturalKey, ResultTransformer transformer)
QueryParameters(Type type, java.lang.Object value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bindDynamicParameter(Type paramType, java.lang.Object paramValue)
QueryParameters
createCopyUsing(RowSelection selection)
java.lang.String
getCacheRegion()
java.io.Serializable[]
getCollectionKeys()
java.lang.String
getComment()
Type[]
getFilteredPositionalParameterTypes()
java.lang.Object[]
getFilteredPositionalParameterValues()
java.lang.String
getFilteredSQL()
LockOptions
getLockOptions()
java.util.Map<java.lang.String,TypedValue>
getNamedParameters()
java.lang.String
getOptionalEntityName()
java.io.Serializable
getOptionalId()
java.lang.Object
getOptionalObject()
Type[]
getPositionalParameterTypes()
java.lang.Object[]
getPositionalParameterValues()
java.util.List<java.lang.String>
getQueryHints()
HQLQueryPlan
getQueryPlan()
ResultTransformer
getResultTransformer()
RowSelection
getRowSelection()
ScrollMode
getScrollMode()
boolean
hasAutoDiscoverScalarTypes()
boolean
hasRowSelection()
boolean
isCacheable()
boolean
isCallable()
boolean
isNaturalKeyLookup()
boolean
isPassDistinctThrough()
Check if this query should pass thedistinct
to the database.boolean
isReadOnly()
Should entities and proxies loaded by the Query be put in read-only mode? The read-only/modifiable setting must be initialized via QueryParameters#setReadOnly(boolean) before calling this method.boolean
isReadOnly(SharedSessionContractImplementor session)
Should entities and proxies loaded by the Query be put in read-only mode? If the read-only/modifiable setting was not initialized (i.e., QueryParameters#isReadOnlyInitialized() == false), then the default read-only/modifiable setting for the persistence context is returned instead.boolean
isReadOnlyInitialized()
Has the read-only/modifiable mode been explicitly set?void
processFilters(java.lang.String sql, java.util.Map filters, SessionFactoryImplementor factory)
void
processFilters(java.lang.String sql, SharedSessionContractImplementor session)
void
setAutoDiscoverScalarTypes(boolean autodiscovertypes)
void
setCacheable(boolean b)
void
setCacheRegion(java.lang.String cacheRegion)
void
setCallable(boolean callable)
void
setCollectionKeys(java.io.Serializable[] collectionKeys)
void
setComment(java.lang.String comment)
void
setLockOptions(LockOptions lockOptions)
void
setNamedParameters(java.util.Map<java.lang.String,TypedValue> map)
void
setNaturalKeyLookup(boolean isNaturalKeyLookup)
void
setOptionalEntityName(java.lang.String optionalEntityName)
void
setOptionalId(java.io.Serializable optionalId)
void
setOptionalObject(java.lang.Object optionalObject)
void
setPassDistinctThrough(boolean passDistinctThrough)
Set if this query should pass thedistinct
to the database.void
setPositionalParameterTypes(Type[] types)
void
setPositionalParameterValues(java.lang.Object[] objects)
void
setQueryHints(java.util.List<java.lang.String> queryHints)
void
setQueryPlan(HQLQueryPlan queryPlan)
void
setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies loaded by the query.void
setRowSelection(RowSelection selection)
void
setScrollMode(ScrollMode scrollMode)
void
traceParameters(SessionFactoryImplementor factory)
void
validateParameters()
-
-
-
Constructor Detail
-
QueryParameters
public QueryParameters()
-
QueryParameters
public QueryParameters(Type type, java.lang.Object value)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, java.lang.Object optionalObject, java.lang.String optionalEntityName, java.io.Serializable optionalObjectId)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, java.io.Serializable[] collectionKeys)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, java.util.Map<java.lang.String,TypedValue> namedParameters, java.io.Serializable[] collectionKeys)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, java.lang.String cacheRegion, java.lang.String comment, java.util.List<java.lang.String> queryHints, boolean isLookupByNaturalKey, ResultTransformer transformer)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, java.util.Map<java.lang.String,TypedValue> namedParameters, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, java.lang.String cacheRegion, java.lang.String comment, java.util.List<java.lang.String> queryHints, java.io.Serializable[] collectionKeys, ResultTransformer transformer)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, java.lang.Object[] positionalParameterValues, java.util.Map<java.lang.String,TypedValue> namedParameters, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, java.lang.String cacheRegion, java.lang.String comment, java.util.List<java.lang.String> queryHints, java.io.Serializable[] collectionKeys, java.lang.Object optionalObject, java.lang.String optionalEntityName, java.io.Serializable optionalId, ResultTransformer transformer)
-
QueryParameters
public QueryParameters(QueryParameterBindings queryParameterBindings, LockOptions lockOptions, RowSelection selection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, java.lang.String cacheRegion, java.lang.String comment, java.util.List<java.lang.String> dbHints, java.io.Serializable[] collectionKeys, java.lang.Object optionalObject, java.lang.String optionalEntityName, java.io.Serializable optionalId, ResultTransformer resultTransformer)
-
-
Method Detail
-
hasRowSelection
public boolean hasRowSelection()
-
getNamedParameters
public java.util.Map<java.lang.String,TypedValue> getNamedParameters()
-
getPositionalParameterTypes
public Type[] getPositionalParameterTypes()
-
getPositionalParameterValues
public java.lang.Object[] getPositionalParameterValues()
-
getRowSelection
public RowSelection getRowSelection()
-
getResultTransformer
public ResultTransformer getResultTransformer()
-
setNamedParameters
public void setNamedParameters(java.util.Map<java.lang.String,TypedValue> map)
-
setPositionalParameterTypes
public void setPositionalParameterTypes(Type[] types)
-
setPositionalParameterValues
public void setPositionalParameterValues(java.lang.Object[] objects)
-
setRowSelection
public void setRowSelection(RowSelection selection)
-
getLockOptions
public LockOptions getLockOptions()
-
setLockOptions
public void setLockOptions(LockOptions lockOptions)
-
traceParameters
public void traceParameters(SessionFactoryImplementor factory) throws HibernateException
- Throws:
HibernateException
-
isCacheable
public boolean isCacheable()
-
setCacheable
public void setCacheable(boolean b)
-
getCacheRegion
public java.lang.String getCacheRegion()
-
setCacheRegion
public void setCacheRegion(java.lang.String cacheRegion)
-
validateParameters
public void validateParameters() throws QueryException
- Throws:
QueryException
-
getComment
public java.lang.String getComment()
-
setComment
public void setComment(java.lang.String comment)
-
getQueryHints
public java.util.List<java.lang.String> getQueryHints()
-
setQueryHints
public void setQueryHints(java.util.List<java.lang.String> queryHints)
-
getScrollMode
public ScrollMode getScrollMode()
-
setScrollMode
public void setScrollMode(ScrollMode scrollMode)
-
getCollectionKeys
public java.io.Serializable[] getCollectionKeys()
-
setCollectionKeys
public void setCollectionKeys(java.io.Serializable[] collectionKeys)
-
getOptionalEntityName
public java.lang.String getOptionalEntityName()
-
setOptionalEntityName
public void setOptionalEntityName(java.lang.String optionalEntityName)
-
getOptionalId
public java.io.Serializable getOptionalId()
-
setOptionalId
public void setOptionalId(java.io.Serializable optionalId)
-
getOptionalObject
public java.lang.Object getOptionalObject()
-
setOptionalObject
public void setOptionalObject(java.lang.Object optionalObject)
-
isReadOnlyInitialized
public boolean isReadOnlyInitialized()
Has the read-only/modifiable mode been explicitly set?- Returns:
- true, the read-only/modifiable mode was explicitly set false, the read-only/modifiable mode was not explicitly set
- See Also:
setReadOnly(boolean)
,isReadOnly(SharedSessionContractImplementor)
-
isReadOnly
public boolean isReadOnly()
Should entities and proxies loaded by the Query be put in read-only mode? The read-only/modifiable setting must be initialized via QueryParameters#setReadOnly(boolean) before calling this method.- Returns:
- true, entities and proxies loaded by the Query will be put in read-only mode false, entities and proxies loaded by the Query will be put in modifiable mode
- Throws:
java.lang.IllegalStateException
- if the read-only/modifiable setting has not been initialized (i.e., isReadOnlyInitialized() == false).- See Also:
isReadOnlyInitialized()
,isReadOnly(SharedSessionContractImplementor)
,The read-only/modifiable setting has no impact on entities/proxies returned by the query that existed in the session before the query was executed.
-
isReadOnly
public boolean isReadOnly(SharedSessionContractImplementor session)
Should entities and proxies loaded by the Query be put in read-only mode? If the read-only/modifiable setting was not initialized (i.e., QueryParameters#isReadOnlyInitialized() == false), then the default read-only/modifiable setting for the persistence context is returned instead. The read-only/modifiable setting has no impact on entities/proxies returned by the query that existed in the session before the query was executed.- Parameters:
session
- The originating session- Returns:
true
indicates that entities and proxies loaded by the query will be put in read-only mode;false
indicates that entities and proxies loaded by the query will be put in modifiable mode- See Also:
isReadOnlyInitialized()
,setReadOnly(boolean)
,The read-only/modifiable setting has no impact on entities/proxies returned by the query that existed in the session before the query was executed.
-
setReadOnly
public void setReadOnly(boolean readOnly)
Set the read-only/modifiable mode for entities and proxies loaded by the query. The read-only/modifiable setting has no impact on entities/proxies returned by the query that existed in the session before the query was executed.- Parameters:
readOnly
- iftrue
, entities and proxies loaded by the query will be put in read-only mode; iffalse
, entities and proxies loaded by the query will be put in modifiable mode- See Also:
isReadOnlyInitialized()
,isReadOnly(SharedSessionContractImplementor)
,setReadOnly(boolean)
,PersistenceContext.isDefaultReadOnly()
-
setCallable
public void setCallable(boolean callable)
-
isCallable
public boolean isCallable()
-
hasAutoDiscoverScalarTypes
public boolean hasAutoDiscoverScalarTypes()
-
isPassDistinctThrough
public boolean isPassDistinctThrough()
Check if this query should pass thedistinct
to the database.- Returns:
- the query passes
distinct
to the database
-
setPassDistinctThrough
public void setPassDistinctThrough(boolean passDistinctThrough)
Set if this query should pass thedistinct
to the database.- Parameters:
passDistinctThrough
- the query passesdistinct
to the database
-
processFilters
public void processFilters(java.lang.String sql, SharedSessionContractImplementor session)
-
processFilters
public void processFilters(java.lang.String sql, java.util.Map filters, SessionFactoryImplementor factory)
-
getFilteredSQL
public java.lang.String getFilteredSQL()
-
getFilteredPositionalParameterValues
public java.lang.Object[] getFilteredPositionalParameterValues()
-
getFilteredPositionalParameterTypes
public Type[] getFilteredPositionalParameterTypes()
-
isNaturalKeyLookup
public boolean isNaturalKeyLookup()
-
setNaturalKeyLookup
public void setNaturalKeyLookup(boolean isNaturalKeyLookup)
-
setAutoDiscoverScalarTypes
public void setAutoDiscoverScalarTypes(boolean autodiscovertypes)
-
createCopyUsing
public QueryParameters createCopyUsing(RowSelection selection)
-
getQueryPlan
public HQLQueryPlan getQueryPlan()
-
setQueryPlan
public void setQueryPlan(HQLQueryPlan queryPlan)
-
bindDynamicParameter
public void bindDynamicParameter(Type paramType, java.lang.Object paramValue)
-
-