public class SQLQueryImpl extends AbstractQueryImpl implements SQLQuery
SQLQuery
contract.SQLQuery.FetchReturn, SQLQuery.ReturnProperty, SQLQuery.RootReturn
parameterMetadata, session
Modifier and Type | Method and Description |
---|---|
SQLQuery |
addEntity(Class entityType)
Declare a "root" entity, without specifying an alias.
|
SQLQuery |
addEntity(String entityName)
Declare a "root" entity, without specifying an alias.
|
SQLQuery |
addEntity(String alias,
Class entityClass)
Declare a "root" entity.
|
SQLQuery |
addEntity(String alias,
Class entityClass,
LockMode lockMode)
Declare a "root" entity, specifying a lock mode.
|
SQLQuery |
addEntity(String alias,
String entityName)
Declare a "root" entity.
|
SQLQuery |
addEntity(String alias,
String entityName,
LockMode lockMode)
Declare a "root" entity, specifying a lock mode.
|
SQLQuery.FetchReturn |
addFetch(String tableAlias,
String ownerTableAlias,
String joinPropertyName)
Declare a join fetch result.
|
SQLQuery |
addJoin(String alias,
String path)
Declare a join fetch result.
|
SQLQuery |
addJoin(String alias,
String path,
LockMode lockMode)
Declare a join fetch result, specifying a lock mode.
|
SQLQuery |
addJoin(String tableAlias,
String ownerTableAlias,
String joinPropertyName)
Declare a join fetch result.
|
SQLQuery.RootReturn |
addRoot(String tableAlias,
Class entityType)
Add a new root return mapping, returning a
SQLQuery.RootReturn to allow further definition. |
SQLQuery.RootReturn |
addRoot(String tableAlias,
String entityName)
Add a new root return mapping, returning a
SQLQuery.RootReturn to allow further definition. |
SQLQuery |
addScalar(String columnAlias)
Declare a scalar query result.
|
SQLQuery |
addScalar(String columnAlias,
Type type)
Declare a scalar query result.
|
SQLQuery |
addSynchronizedEntityClass(Class entityClass)
Adds an entity for (a) auto-flush checking and (b) query result cache invalidation checking.
|
SQLQuery |
addSynchronizedEntityName(String entityName)
Adds an entity name for (a) auto-flush checking and (b) query result cache invalidation checking.
|
SQLQuery |
addSynchronizedQuerySpace(String querySpace)
Adds a query space.
|
int |
executeUpdate()
Execute the update or delete statement.
|
LockOptions |
getLockOptions()
Obtains the LockOptions in effect for this query.
|
QueryParameters |
getQueryParameters(Map namedParams) |
List<NativeSQLQueryReturn> |
getQueryReturns()
Retrieve the returns associated with this query.
|
String[] |
getReturnAliases()
Return the HQL select clause aliases, if any.
|
Type[] |
getReturnTypes()
Return the Hibernate types of the query results.
|
Collection<String> |
getSynchronizedQuerySpaces()
Obtain the list of query spaces the query is synchronized on.
|
boolean |
isCallable()
Is this native-SQL query known to be callable?
|
Iterator |
iterate()
Return the query results as an Iterator.
|
List |
list()
Return the query results as a List.
|
ScrollableResults |
scroll()
Return the query results as ScrollableResults.
|
ScrollableResults |
scroll(ScrollMode scrollMode)
Return the query results as ScrollableResults.
|
Query |
setLockMode(String alias,
LockMode lockMode)
Set the LockMode to use for specific alias (as defined in the query's FROM clause).
|
Query |
setLockOptions(LockOptions lockOptions)
Set the lock options for the query.
|
SQLQuery |
setResultSetMapping(String name)
Use a predefined named result-set mapping.
|
protected void |
verifyParameters()
Perform parameter validation.
|
addQueryHint, after, applyEntityGraphQueryHint, before, determineType, determineType, determineType, determineType, determineType, expandParameterLists, getCacheMode, getCacheRegion, getComment, getFetchSize, getFirstResult, getFlushMode, getMaxResults, getNamedParameterLists, getNamedParameters, getNamedParams, getParameterMetadata, getQueryString, getRowSelection, getTimeout, getTypes, getValues, guessType, hasNamedParameters, isCacheable, isReadOnly, setBigDecimal, setBigDecimal, setBigInteger, setBigInteger, setBinary, setBinary, setBoolean, setBoolean, setByte, setByte, setCacheable, setCacheMode, setCacheRegion, setCalendar, setCalendar, setCalendarDate, setCalendarDate, setCharacter, setCharacter, setCollectionKey, setComment, setDate, setDate, setDouble, setDouble, setEntity, setEntity, setFetchSize, setFirstResult, setFloat, setFloat, setFlushMode, setInteger, setInteger, setLocale, setLocale, setLong, setLong, setMaxResults, setOptionalEntityName, setOptionalId, setOptionalObject, setParameter, setParameter, setParameter, setParameter, setParameterList, setParameterList, setParameterList, setParameterList, setParameters, setProperties, setProperties, setReadOnly, setResultTransformer, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimeout, setTimestamp, setTimestamp, toString, typeArray, uniqueResult, valueArray, verifyParameters
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addQueryHint, getComment, getFirstResult, getMaxResults, getNamedParameters, getQueryString, setBigDecimal, setBigDecimal, setBigInteger, setBigInteger, setBinary, setBinary, setBoolean, setBoolean, setByte, setByte, setCacheable, setCacheMode, setCacheRegion, setCalendar, setCalendar, setCalendarDate, setCalendarDate, setCharacter, setCharacter, setComment, setDate, setDate, setDouble, setDouble, setEntity, setEntity, setFetchSize, setFirstResult, setFloat, setFloat, setFlushMode, setInteger, setInteger, setLocale, setLocale, setLong, setLong, setMaxResults, setParameter, setParameter, setParameter, setParameter, setParameterList, setParameterList, setParameterList, setParameterList, setParameters, setProperties, setProperties, setReadOnly, setResultTransformer, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimeout, setTimestamp, setTimestamp, uniqueResult
getCacheMode, getCacheRegion, getFetchSize, getFlushMode, getTimeout, isCacheable, isReadOnly
public List<NativeSQLQueryReturn> getQueryReturns()
SQLQuery
getQueryReturns
in interface SQLQuery
public Collection<String> getSynchronizedQuerySpaces()
SynchronizeableQuery
getSynchronizedQuerySpaces
in interface SynchronizeableQuery
public boolean isCallable()
SQLQuery
isCallable
in interface SQLQuery
true
if the query is known to be callable; false
otherwise.public List list() throws HibernateException
Query
list
in interface Query
HibernateException
public ScrollableResults scroll(ScrollMode scrollMode) throws HibernateException
Query
scroll
in interface Query
scrollMode
- The scroll modeHibernateException
ScrollableResults
,
ScrollMode
public ScrollableResults scroll() throws HibernateException
Query
scroll
in interface Query
HibernateException
ScrollableResults
public Iterator iterate() throws HibernateException
Query
iterate
in interface Query
HibernateException
public QueryParameters getQueryParameters(Map namedParams)
getQueryParameters
in class AbstractQueryImpl
protected void verifyParameters()
AbstractQueryImpl
verifyParameters
in class AbstractQueryImpl
public String[] getReturnAliases() throws HibernateException
Query
getReturnAliases
in interface Query
getReturnAliases
in class AbstractQueryImpl
HibernateException
public Type[] getReturnTypes() throws HibernateException
BasicQueryContract
getReturnTypes
in interface BasicQueryContract
getReturnTypes
in class AbstractQueryImpl
HibernateException
public Query setLockMode(String alias, LockMode lockMode)
Query
LockOptions
.
The effect of these alias-specific LockModes is somewhat dependent on the driver/database in use. Generally
speaking, for maximum portability, this method should only be used to mark that the rows corresponding to
the given alias should be included in pessimistic locking (LockMode.PESSIMISTIC_WRITE
).setLockMode
in interface Query
alias
- a query alias, or "this"
for a collection filterlockMode
- The lock mode to apply.this
, for method chainingQuery.getLockOptions()
public Query setLockOptions(LockOptions lockOptions)
Query
Query.setLockMode(String, LockMode)
.setLockOptions
in interface Query
lockOptions
- The lock options to apply to the query.this
, for method chainingQuery.getLockOptions()
public LockOptions getLockOptions()
Query
getLockOptions
in interface Query
getLockOptions
in class AbstractQueryImpl
LockOptions
public SQLQuery addScalar(String columnAlias, Type type)
SQLQuery
public SQLQuery addScalar(String columnAlias)
SQLQuery
<return-scalar/>
in hbm.xml
or ColumnResult
public SQLQuery.RootReturn addRoot(String tableAlias, String entityName)
SQLQuery
SQLQuery.RootReturn
to allow further definition.public SQLQuery.RootReturn addRoot(String tableAlias, Class entityType)
SQLQuery
SQLQuery.RootReturn
to allow further definition.public SQLQuery addEntity(String entityName)
SQLQuery
SQLQuery.addRoot(java.lang.String, java.lang.String)
if you need further control of the mappingpublic SQLQuery addEntity(String alias, String entityName)
SQLQuery
public SQLQuery addEntity(String alias, String entityName, LockMode lockMode)
SQLQuery
public SQLQuery addEntity(Class entityType)
SQLQuery
public SQLQuery addEntity(String alias, Class entityClass)
SQLQuery
public SQLQuery addEntity(String alias, Class entityClass, LockMode lockMode)
SQLQuery
public SQLQuery.FetchReturn addFetch(String tableAlias, String ownerTableAlias, String joinPropertyName)
SQLQuery
addFetch
in interface SQLQuery
tableAlias
- The SQL table alias for the data to be mapped to this fetchownerTableAlias
- Identify the table alias of the owner of this association. Should match the alias of a
previously added root or fetchjoinPropertyName
- The name of the property being join fetched.public SQLQuery addJoin(String tableAlias, String ownerTableAlias, String joinPropertyName)
SQLQuery
addJoin
in interface SQLQuery
tableAlias
- The SQL table alias for the data to be mapped to this fetchownerTableAlias
- Identify the table alias of the owner of this association. Should match the alias of a
previously added root or fetchjoinPropertyName
- The name of the property being join fetched.this
, for method chainingpublic SQLQuery addJoin(String alias, String path)
SQLQuery
public SQLQuery addJoin(String alias, String path, LockMode lockMode)
SQLQuery
public SQLQuery setResultSetMapping(String name)
SQLQuery
<result-set/>
element in a
Hibernate hbm.xml file or through a SqlResultSetMapping
annotation.setResultSetMapping
in interface SQLQuery
name
- The name of the mapping to use.public SQLQuery addSynchronizedQuerySpace(String querySpace)
SynchronizeableQuery
addSynchronizedQuerySpace
in interface SQLQuery
addSynchronizedQuerySpace
in interface SynchronizeableQuery
querySpace
- The query space to be auto-flushed for this query.this
, for method chainingpublic SQLQuery addSynchronizedEntityName(String entityName)
SynchronizeableQuery
SynchronizeableQuery.addSynchronizedQuerySpace(java.lang.String)
for all tables associated with the given entity.addSynchronizedEntityName
in interface SQLQuery
addSynchronizedEntityName
in interface SynchronizeableQuery
entityName
- The name of the entity upon whose defined query spaces we should additionally synchronize.this
, for method chainingpublic SQLQuery addSynchronizedEntityClass(Class entityClass)
SynchronizeableQuery
SynchronizeableQuery.addSynchronizedQuerySpace(java.lang.String)
for all tables associated with the given entity.addSynchronizedEntityClass
in interface SQLQuery
addSynchronizedEntityClass
in interface SynchronizeableQuery
entityClass
- The class of the entity upon whose defined query spaces we should additionally synchronize.this
, for method chainingpublic int executeUpdate() throws HibernateException
Query
executeUpdate
in interface Query
HibernateException
Copyright © 2017 JBoss by Red Hat. All rights reserved.