Package org.hibernate.engine.spi
Class QueryParameters
- java.lang.Object
-
- org.hibernate.engine.spi.QueryParameters
-
public final class QueryParameters extends Object
-
-
Constructor Summary
Constructors Constructor Description QueryParameters()QueryParameters(QueryParameterBindings queryParameterBindings, LockOptions lockOptions, RowSelection selection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, String cacheRegion, String comment, List<String> dbHints, Serializable[] collectionKeys, Object optionalObject, String optionalEntityName, Serializable optionalId, ResultTransformer resultTransformer)QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues)QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, Serializable[] collectionKeys)QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, Object optionalObject, String optionalEntityName, Serializable optionalObjectId)QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, Map<String,TypedValue> namedParameters, Serializable[] collectionKeys)QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, Map<String,TypedValue> namedParameters, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, String cacheRegion, String comment, List<String> queryHints, Serializable[] collectionKeys, Object optionalObject, String optionalEntityName, Serializable optionalId, ResultTransformer transformer)QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, Map<String,TypedValue> namedParameters, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, String cacheRegion, String comment, List<String> queryHints, Serializable[] collectionKeys, ResultTransformer transformer)QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, String cacheRegion, String comment, List<String> queryHints, boolean isLookupByNaturalKey, ResultTransformer transformer)QueryParameters(Type type, Object value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbindDynamicParameter(Type paramType, Object paramValue)QueryParameterscreateCopyUsing(RowSelection selection)StringgetCacheRegion()Serializable[]getCollectionKeys()StringgetComment()Type[]getFilteredPositionalParameterTypes()Object[]getFilteredPositionalParameterValues()StringgetFilteredSQL()LockOptionsgetLockOptions()Map<String,TypedValue>getNamedParameters()StringgetOptionalEntityName()SerializablegetOptionalId()ObjectgetOptionalObject()Type[]getPositionalParameterTypes()Object[]getPositionalParameterValues()List<String>getQueryHints()HQLQueryPlangetQueryPlan()ResultTransformergetResultTransformer()RowSelectiongetRowSelection()ScrollModegetScrollMode()booleanhasAutoDiscoverScalarTypes()booleanhasRowSelection()booleanisCacheable()booleanisCallable()booleanisNaturalKeyLookup()booleanisPassDistinctThrough()Check if this query should pass thedistinctto the database.booleanisReadOnly()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.booleanisReadOnly(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.booleanisReadOnlyInitialized()Has the read-only/modifiable mode been explicitly set?voidprocessFilters(String sql, Map filters, SessionFactoryImplementor factory)voidprocessFilters(String sql, SharedSessionContractImplementor session)voidsetAutoDiscoverScalarTypes(boolean autodiscovertypes)voidsetCacheable(boolean b)voidsetCacheRegion(String cacheRegion)voidsetCallable(boolean callable)voidsetCollectionKeys(Serializable[] collectionKeys)voidsetComment(String comment)voidsetLockOptions(LockOptions lockOptions)voidsetNamedParameters(Map<String,TypedValue> map)voidsetNaturalKeyLookup(boolean isNaturalKeyLookup)voidsetOptionalEntityName(String optionalEntityName)voidsetOptionalId(Serializable optionalId)voidsetOptionalObject(Object optionalObject)voidsetPassDistinctThrough(boolean passDistinctThrough)Set if this query should pass thedistinctto the database.voidsetPositionalParameterTypes(Type[] types)voidsetPositionalParameterValues(Object[] objects)voidsetQueryHints(List<String> queryHints)voidsetQueryPlan(HQLQueryPlan queryPlan)voidsetReadOnly(boolean readOnly)Set the read-only/modifiable mode for entities and proxies loaded by the query.voidsetRowSelection(RowSelection selection)voidsetScrollMode(ScrollMode scrollMode)voidtraceParameters(SessionFactoryImplementor factory)voidvalidateParameters()
-
-
-
Constructor Detail
-
QueryParameters
public QueryParameters()
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, Object optionalObject, String optionalEntityName, Serializable optionalObjectId)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, Serializable[] collectionKeys)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, Map<String,TypedValue> namedParameters, Serializable[] collectionKeys)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, String cacheRegion, String comment, List<String> queryHints, boolean isLookupByNaturalKey, ResultTransformer transformer)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, Map<String,TypedValue> namedParameters, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, String cacheRegion, String comment, List<String> queryHints, Serializable[] collectionKeys, ResultTransformer transformer)
-
QueryParameters
public QueryParameters(Type[] positionalParameterTypes, Object[] positionalParameterValues, Map<String,TypedValue> namedParameters, LockOptions lockOptions, RowSelection rowSelection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, String cacheRegion, String comment, List<String> queryHints, Serializable[] collectionKeys, Object optionalObject, String optionalEntityName, Serializable optionalId, ResultTransformer transformer)
-
QueryParameters
public QueryParameters(QueryParameterBindings queryParameterBindings, LockOptions lockOptions, RowSelection selection, boolean isReadOnlyInitialized, boolean readOnly, boolean cacheable, String cacheRegion, String comment, List<String> dbHints, Serializable[] collectionKeys, Object optionalObject, String optionalEntityName, Serializable optionalId, ResultTransformer resultTransformer)
-
-
Method Detail
-
hasRowSelection
public boolean hasRowSelection()
-
getNamedParameters
public Map<String,TypedValue> getNamedParameters()
-
getPositionalParameterTypes
public Type[] getPositionalParameterTypes()
-
getPositionalParameterValues
public Object[] getPositionalParameterValues()
-
getRowSelection
public RowSelection getRowSelection()
-
getResultTransformer
public ResultTransformer getResultTransformer()
-
setNamedParameters
public void setNamedParameters(Map<String,TypedValue> map)
-
setPositionalParameterTypes
public void setPositionalParameterTypes(Type[] types)
-
setPositionalParameterValues
public void setPositionalParameterValues(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 String getCacheRegion()
-
setCacheRegion
public void setCacheRegion(String cacheRegion)
-
validateParameters
public void validateParameters() throws QueryException- Throws:
QueryException
-
getComment
public String getComment()
-
setComment
public void setComment(String comment)
-
getScrollMode
public ScrollMode getScrollMode()
-
setScrollMode
public void setScrollMode(ScrollMode scrollMode)
-
getCollectionKeys
public Serializable[] getCollectionKeys()
-
setCollectionKeys
public void setCollectionKeys(Serializable[] collectionKeys)
-
getOptionalEntityName
public String getOptionalEntityName()
-
setOptionalEntityName
public void setOptionalEntityName(String optionalEntityName)
-
getOptionalId
public Serializable getOptionalId()
-
setOptionalId
public void setOptionalId(Serializable optionalId)
-
getOptionalObject
public Object getOptionalObject()
-
setOptionalObject
public void setOptionalObject(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:
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:
trueindicates that entities and proxies loaded by the query will be put in read-only mode;falseindicates 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 thedistinctto the database.- Returns:
- the query passes
distinctto the database
-
setPassDistinctThrough
public void setPassDistinctThrough(boolean passDistinctThrough)
Set if this query should pass thedistinctto the database.- Parameters:
passDistinctThrough- the query passesdistinctto the database
-
processFilters
public void processFilters(String sql, SharedSessionContractImplementor session)
-
processFilters
public void processFilters(String sql, Map filters, SessionFactoryImplementor factory)
-
getFilteredSQL
public String getFilteredSQL()
-
getFilteredPositionalParameterValues
public 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)
-
-