Package org.hibernate.impl
Class SQLQueryImpl
java.lang.Object
org.hibernate.impl.AbstractQueryImpl
org.hibernate.impl.SQLQueryImpl
Implementation of the
SQLQuery contract.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.hibernate.SQLQuery
SQLQuery.FetchReturn, SQLQuery.ReturnProperty, SQLQuery.RootReturn -
Field Summary
Fields inherited from class org.hibernate.impl.AbstractQueryImpl
parameterMetadata, session -
Method Summary
Modifier and TypeMethodDescriptionDeclare a "root" entity, without specifying an alias.Declare a "root" entity, without specifying an alias.Declare a "root" entityDeclare a "root" entity, specifying a lock modeDeclare a "root" entityDeclare a "root" entity, specifying a lock modeDeclare a join fetch result.Declare a join fetch result.Declare a join fetch result.Declare a join fetch result, specifying a lock modeAdd a new root return mapping, returning aSQLQuery.RootReturnto allow further definitionAdd a new root return mapping, returning aSQLQuery.RootReturnto allow further definitionDeclare a scalar query result.Declare a scalar query result.addSynchronizedEntityClass(Class entityClass) Adds an entity for (a) auto-flush checking and (b) query result cache invalidation checking.addSynchronizedEntityName(String entityName) Adds an entity name for (a) auto-flush checking and (b) query result cache invalidation checking.addSynchronizedQuerySpace(String querySpace) Adds a query space (table name) for (a) auto-flush checking and (b) query result cache invalidation checkingintExecute the update or delete statement.getQueryParameters(Map namedParams) String[]Return the HQL select clause aliases (if any)Type[]Return the Hibernate types of the query result set.iterate()Return the query results as an Iterator.list()Return the query results as a List.scroll()Return the query results as ScrollableResults.scroll(ScrollMode scrollMode) Return the query results as ScrollableResults.setLockMode(String alias, LockMode lockMode) Set the lockmode for the objects idententified by the given alias that appears in the FROM clause.setLockOptions(LockOptions lockOptions) Set the lock options for the objects idententified by the given alias that appears in the FROM clause.setResultSetMapping(String name) Use a predefined named result-set mapping.protected voidPerform parameter validation.Methods inherited from class org.hibernate.impl.AbstractQueryImpl
after, before, determineType, determineType, determineType, determineType, determineType, expandParameterLists, getCacheMode, getNamedParameterLists, getNamedParameters, getNamedParams, getParameterMetadata, getQueryString, getRowSelection, getSelection, getTypes, getValues, hasNamedParameters, 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, verifyParametersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hibernate.Query
getNamedParameters, getQueryString, isReadOnly, 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
-
Method Details
-
list
Description copied from interface:QueryReturn the query results as a List. If the query contains multiple results pre row, the results are returned in an instance of Object[].- Specified by:
listin interfaceQuery- Returns:
- the result list
- Throws:
HibernateException
-
scroll
Description copied from interface:QueryReturn the query results as ScrollableResults. The scrollability of the returned results depends upon JDBC driver support for scrollable ResultSets.- Specified by:
scrollin interfaceQuery- Returns:
- the result iterator
- Throws:
HibernateException- See Also:
-
scroll
Description copied from interface:QueryReturn the query results as ScrollableResults. The scrollability of the returned results depends upon JDBC driver support for scrollable ResultSets.- Specified by:
scrollin interfaceQuery- Returns:
- the result iterator
- Throws:
HibernateException- See Also:
-
iterate
Description copied from interface:QueryReturn the query results as an Iterator. If the query contains multiple results pre row, the results are returned in an instance of Object[].
Entities returned as results are initialized on demand. The first SQL query returns identifiers only.- Specified by:
iteratein interfaceQuery- Returns:
- the result iterator
- Throws:
HibernateException
-
getQueryParameters
- Overrides:
getQueryParametersin classAbstractQueryImpl
-
verifyParameters
protected void verifyParameters()Description copied from class:AbstractQueryImplPerform parameter validation. Used prior to executing the encapsulated query.- Overrides:
verifyParametersin classAbstractQueryImpl
-
getReturnAliases
Description copied from interface:QueryReturn the HQL select clause aliases (if any)- Specified by:
getReturnAliasesin interfaceQuery- Overrides:
getReturnAliasesin classAbstractQueryImpl- Returns:
- an array of aliases as strings
- Throws:
HibernateException
-
getReturnTypes
Description copied from interface:QueryReturn the Hibernate types of the query result set.- Specified by:
getReturnTypesin interfaceQuery- Overrides:
getReturnTypesin classAbstractQueryImpl- Returns:
- an array of types
- Throws:
HibernateException
-
setLockMode
Description copied from interface:QuerySet the lockmode for the objects idententified by the given alias that appears in the FROM clause.- Specified by:
setLockModein interfaceQuery- Parameters:
alias- a query alias, or this for a collection filter
-
setLockOptions
Description copied from interface:QuerySet the lock options for the objects idententified by the given alias that appears in the FROM clause.- Specified by:
setLockOptionsin interfaceQuery
-
getLockOptions
- Specified by:
getLockOptionsin classAbstractQueryImpl
-
addScalar
Description copied from interface:SQLQueryDeclare a scalar query result. Functions like<return-scalar/>inhbm.xmlorColumnResult -
addScalar
Description copied from interface:SQLQueryDeclare a scalar query result. Hibernate will attempt to automatically detect the underlying type. Functions like<return-scalar/>inhbm.xmlorColumnResult -
addRoot
Description copied from interface:SQLQueryAdd a new root return mapping, returning aSQLQuery.RootReturnto allow further definition -
addRoot
Description copied from interface:SQLQueryAdd a new root return mapping, returning aSQLQuery.RootReturnto allow further definition -
addEntity
Description copied from interface:SQLQueryDeclare a "root" entity, without specifying an alias. The expectation here is that the table alias is the same as the unqualified entity name UseSQLQuery.addRoot(java.lang.String, java.lang.String)if you need further control of the mapping -
addEntity
Description copied from interface:SQLQueryDeclare a "root" entity -
addEntity
Description copied from interface:SQLQueryDeclare a "root" entity, specifying a lock mode -
addEntity
Description copied from interface:SQLQueryDeclare a "root" entity, without specifying an alias. The expectation here is that the table alias is the same as the unqualified entity name -
addEntity
Description copied from interface:SQLQueryDeclare a "root" entity -
addEntity
Description copied from interface:SQLQueryDeclare a "root" entity, specifying a lock mode -
addFetch
public SQLQuery.FetchReturn addFetch(String tableAlias, String ownerTableAlias, String joinPropertyName) Description copied from interface:SQLQueryDeclare a join fetch result.- Specified by:
addFetchin interfaceSQLQuery- Parameters:
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.- Returns:
- The return config object for further control.
-
addJoin
Description copied from interface:SQLQueryDeclare a join fetch result.- Specified by:
addJoinin interfaceSQLQuery- Parameters:
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.- Returns:
this, for method chaining
-
addJoin
Description copied from interface:SQLQueryDeclare a join fetch result. -
addJoin
Description copied from interface:SQLQueryDeclare a join fetch result, specifying a lock mode -
setResultSetMapping
Description copied from interface:SQLQueryUse a predefined named result-set mapping. This might be defined by a<result-set/>element in a Hibernate hbm.xml file or through aSqlResultSetMappingannotation.- Specified by:
setResultSetMappingin interfaceSQLQuery- Parameters:
name- The name of the mapping to use.- Returns:
- this, for method chaining
-
addSynchronizedQuerySpace
Description copied from interface:SQLQueryAdds a query space (table name) for (a) auto-flush checking and (b) query result cache invalidation checking- Specified by:
addSynchronizedQuerySpacein interfaceSQLQuery- Parameters:
querySpace- The query space to be auto-flushed for this query.- Returns:
- this, for method chaining
-
addSynchronizedEntityName
Description copied from interface:SQLQueryAdds an entity name for (a) auto-flush checking and (b) query result cache invalidation checking. Same asSQLQuery.addSynchronizedQuerySpace(java.lang.String)for all tables associated with the given entity.- Specified by:
addSynchronizedEntityNamein interfaceSQLQuery- Parameters:
entityName- The name of the entity upon whose defined query spaces we should additionally synchronize.- Returns:
- this, for method chaining
-
addSynchronizedEntityClass
Description copied from interface:SQLQueryAdds an entity for (a) auto-flush checking and (b) query result cache invalidation checking. Same asSQLQuery.addSynchronizedQuerySpace(java.lang.String)for all tables associated with the given entity.- Specified by:
addSynchronizedEntityClassin interfaceSQLQuery- Parameters:
entityClass- The class of the entity upon whose defined query spaces we should additionally synchronize.- Returns:
- this, for method chaining
-
executeUpdate
Description copied from interface:QueryExecute the update or delete statement. The semantics are compliant with the ejb3 Query.executeUpdate() method.- Specified by:
executeUpdatein interfaceQuery- Returns:
- The number of entities updated or deleted.
- Throws:
HibernateException
-