|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hibernate.impl.AbstractQueryImpl
Abstract implementation of the Query interface
Field Summary | |
protected SessionImplementor |
session
|
Constructor Summary | |
AbstractQueryImpl(String queryString,
FlushMode flushMode,
SessionImplementor session)
|
Method Summary | |
protected void |
after()
|
protected void |
before()
|
protected String |
bindParameterLists(Map namedParamsCopy)
Warning: adds new parameters to the argument by side-effect! |
int |
executeUpdate()
Execute the update or delete statement. |
protected abstract Map |
getLockModes()
|
protected Map |
getNamedParameterLists()
|
String[] |
getNamedParameters()
Return the names of all named parameters of the query. |
protected Map |
getNamedParams()
|
QueryParameters |
getQueryParameters(Map namedParams)
|
String |
getQueryString()
Get the query string. |
String[] |
getReturnAliases()
Return the HQL select clause aliases (if any) |
Type[] |
getReturnTypes()
Return the Hibernate types of the query result set. |
protected RowSelection |
getRowSelection()
|
RowSelection |
getSelection()
|
protected List |
getTypes()
|
protected List |
getValues()
|
boolean |
isReadOnly()
|
Query |
setBigDecimal(int position,
BigDecimal number)
|
Query |
setBigDecimal(String name,
BigDecimal number)
|
Query |
setBigInteger(int position,
BigInteger number)
|
Query |
setBigInteger(String name,
BigInteger number)
|
Query |
setBinary(int position,
byte[] val)
|
Query |
setBinary(String name,
byte[] val)
|
Query |
setBoolean(int position,
boolean val)
|
Query |
setBoolean(String name,
boolean val)
|
Query |
setByte(int position,
byte val)
|
Query |
setByte(String name,
byte val)
|
Query |
setCacheable(boolean cacheable)
Enable caching of this query result set. |
Query |
setCacheMode(CacheMode cacheMode)
Override the current session cache mode, just for this query. |
Query |
setCacheRegion(String cacheRegion)
Set the name of the cache region. |
Query |
setCalendar(int position,
Calendar calendar)
|
Query |
setCalendar(String name,
Calendar calendar)
|
Query |
setCalendarDate(int position,
Calendar calendar)
|
Query |
setCalendarDate(String name,
Calendar calendar)
|
Query |
setCharacter(int position,
char val)
|
Query |
setCharacter(String name,
char val)
|
Query |
setCollectionKey(Serializable collectionKey)
|
Query |
setComment(String comment)
Add a comment to the generated SQL. |
Query |
setDate(int position,
Date date)
|
Query |
setDate(String name,
Date date)
|
Query |
setDouble(int position,
double val)
|
Query |
setDouble(String name,
double val)
|
Query |
setEntity(int position,
Object val)
Bind an instance of a mapped persistent class to a JDBC-style query parameter. |
Query |
setEntity(String name,
Object val)
Bind an instance of a mapped persistent class to a named query parameter. |
Query |
setFetchSize(int fetchSize)
Set a fetch size for the underlying JDBC query. |
Query |
setFirstResult(int firstResult)
Set the first row to retrieve. |
Query |
setFloat(int position,
float val)
|
Query |
setFloat(String name,
float val)
|
Query |
setFlushMode(FlushMode flushMode)
Override the current session flush mode, just for this query. |
Query |
setInteger(int position,
int val)
|
Query |
setInteger(String name,
int val)
|
Query |
setLocale(int position,
Locale locale)
|
Query |
setLocale(String name,
Locale locale)
|
Query |
setLong(int position,
long val)
|
Query |
setLong(String name,
long val)
|
Query |
setMaxResults(int maxResults)
Set the maximum number of rows to retrieve. |
Query |
setParameter(int position,
Object val)
Bind a value to a JDBC-style query parameter, guessing the Hibernate type from the class of the given object. |
Query |
setParameter(int position,
Object val,
Type type)
Bind a value to a JDBC-style query parameter. |
Query |
setParameter(String name,
Object val)
Bind a value to a named query parameter, guessing the Hibernate type from the class of the given object. |
Query |
setParameter(String name,
Object val,
Type type)
Bind a value to a named query parameter. |
Query |
setParameterList(String name,
Collection vals)
Bind multiple values to a named query parameter, guessing the Hibernate type from the class of the first object in the collection. |
Query |
setParameterList(String name,
Collection vals,
Type type)
Bind multiple values to a named query parameter. |
Query |
setParameterList(String name,
Object[] vals)
Bind multiple values to a named query parameter, guessing the Hibernate type from the class of the first object in the array. |
Query |
setParameterList(String name,
Object[] vals,
Type type)
Bind multiple values to a named query parameter. |
Query |
setParameters(Object[] values,
Type[] types)
Bind values and types to positional parameters. |
Query |
setProperties(Object bean)
Bind the property values of the given bean to named parameters of the query, matching property names with parameter names and mapping property types to Hibernate types using hueristics. |
Query |
setReadOnly(boolean readOnly)
Entities retrieved by this query will be loaded in a read-only mode where Hibernate will never dirty-check them or make changes persistent. |
Query |
setSerializable(int position,
Serializable val)
|
Query |
setSerializable(String name,
Serializable val)
|
Query |
setShort(int position,
short val)
|
Query |
setShort(String name,
short val)
|
Query |
setString(int position,
String val)
|
Query |
setString(String name,
String val)
|
Query |
setText(int position,
String val)
|
Query |
setText(String name,
String val)
|
Query |
setTime(int position,
Date date)
|
Query |
setTime(String name,
Date date)
|
Query |
setTimeout(int timeout)
Set a timeout for the underlying JDBC query. |
Query |
setTimestamp(int position,
Date date)
|
Query |
setTimestamp(String name,
Date date)
|
String |
toString()
|
Type[] |
typeArray()
|
Object |
uniqueResult()
Convenience method to return a single instance that matches the query, or null if the query returns no results. |
Object[] |
valueArray()
|
protected void |
verifyParameters()
|
protected void |
verifyParameters(boolean reserveFirstParameter)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.hibernate.Query |
iterate, list, scroll, scroll, setLockMode |
Field Detail |
protected final SessionImplementor session
Constructor Detail |
public AbstractQueryImpl(String queryString, FlushMode flushMode, SessionImplementor session)
Method Detail |
public final String getQueryString()
Query
getQueryString
in interface Query
public Query setFlushMode(FlushMode flushMode)
Query
setFlushMode
in interface Query
FlushMode
public Query setCacheMode(CacheMode cacheMode)
Query
setCacheMode
in interface Query
CacheMode
protected Map getNamedParams()
protected void verifyParameters() throws QueryException
QueryException
protected void verifyParameters(boolean reserveFirstParameter) throws HibernateException
reserveFirstParameter
- if true, the first ? will not be verified since its needed for e.g. callable statements returning a out parameter
HibernateException
protected Map getNamedParameterLists()
protected List getValues()
protected List getTypes()
public RowSelection getSelection()
public Query setMaxResults(int maxResults)
Query
setMaxResults
in interface Query
maxResults
- the maximum number of rowspublic Query setTimeout(int timeout)
Query
setTimeout
in interface Query
timeout
- the timeout in secondspublic Query setFetchSize(int fetchSize)
Query
setFetchSize
in interface Query
fetchSize
- the fetch sizepublic Query setFirstResult(int firstResult)
Query
setFirstResult
in interface Query
firstResult
- a row number, numbered from 0public Query setParameter(int position, Object val, Type type)
Query
setParameter
in interface Query
position
- the position of the parameter in the query
string, numbered from 0.val
- the possibly-null parameter valuetype
- the Hibernate typepublic Query setString(int position, String val)
setString
in interface Query
public Query setCharacter(int position, char val)
setCharacter
in interface Query
public Query setBoolean(int position, boolean val)
setBoolean
in interface Query
public Query setByte(int position, byte val)
setByte
in interface Query
public Query setShort(int position, short val)
setShort
in interface Query
public Query setInteger(int position, int val)
setInteger
in interface Query
public Query setLong(int position, long val)
setLong
in interface Query
public Query setFloat(int position, float val)
setFloat
in interface Query
public Query setDouble(int position, double val)
setDouble
in interface Query
public Query setBinary(int position, byte[] val)
setBinary
in interface Query
public Query setText(int position, String val)
setText
in interface Query
public Query setSerializable(int position, Serializable val)
setSerializable
in interface Query
public Query setDate(int position, Date date)
setDate
in interface Query
public Query setTime(int position, Date date)
setTime
in interface Query
public Query setTimestamp(int position, Date date)
setTimestamp
in interface Query
public Query setEntity(int position, Object val)
Query
setEntity
in interface Query
position
- the position of the parameter in the query
string, numbered from 0.val
- a non-null instance of a persistent classpublic Query setLocale(int position, Locale locale)
setLocale
in interface Query
public Query setCalendar(int position, Calendar calendar)
setCalendar
in interface Query
public Query setCalendarDate(int position, Calendar calendar)
setCalendarDate
in interface Query
public Query setBinary(String name, byte[] val)
setBinary
in interface Query
public Query setText(String name, String val)
setText
in interface Query
public Query setBoolean(String name, boolean val)
setBoolean
in interface Query
public Query setByte(String name, byte val)
setByte
in interface Query
public Query setCharacter(String name, char val)
setCharacter
in interface Query
public Query setDate(String name, Date date)
setDate
in interface Query
public Query setDouble(String name, double val)
setDouble
in interface Query
public Query setEntity(String name, Object val)
Query
setEntity
in interface Query
name
- the name of the parameterval
- a non-null instance of a persistent classpublic Query setFloat(String name, float val)
setFloat
in interface Query
public Query setInteger(String name, int val)
setInteger
in interface Query
public Query setLocale(String name, Locale locale)
setLocale
in interface Query
public Query setCalendar(String name, Calendar calendar)
setCalendar
in interface Query
public Query setCalendarDate(String name, Calendar calendar)
setCalendarDate
in interface Query
public Query setLong(String name, long val)
setLong
in interface Query
public Query setParameter(String name, Object val, Type type)
Query
setParameter
in interface Query
name
- the name of the parameterval
- the possibly-null parameter valuetype
- the Hibernate typepublic Query setSerializable(String name, Serializable val)
setSerializable
in interface Query
public Query setShort(String name, short val)
setShort
in interface Query
public Query setString(String name, String val)
setString
in interface Query
public Query setTime(String name, Date date)
setTime
in interface Query
public Query setTimestamp(String name, Date date)
setTimestamp
in interface Query
public Query setBigDecimal(int position, BigDecimal number)
setBigDecimal
in interface Query
public Query setBigDecimal(String name, BigDecimal number)
setBigDecimal
in interface Query
public Query setBigInteger(int position, BigInteger number)
setBigInteger
in interface Query
public Query setBigInteger(String name, BigInteger number)
setBigInteger
in interface Query
public Query setParameter(int position, Object val) throws HibernateException
Query
setParameter
in interface Query
position
- the position of the parameter in the query
string, numbered from 0.val
- the non-null parameter value
HibernateException
- if no type could be determinedpublic Query setParameter(String name, Object val) throws HibernateException
Query
setParameter
in interface Query
name
- the name of the parameterval
- the non-null parameter value
HibernateException
- if no type could be determinedpublic Type[] getReturnTypes() throws HibernateException
Query
getReturnTypes
in interface Query
HibernateException
public String[] getReturnAliases() throws HibernateException
Query
getReturnAliases
in interface Query
HibernateException
public Query setParameterList(String name, Collection vals, Type type) throws HibernateException
Query
setParameterList
in interface Query
name
- the name of the parametervals
- a collection of values to listtype
- the Hibernate type of the values
HibernateException
protected String bindParameterLists(Map namedParamsCopy)
public Query setParameterList(String name, Collection vals) throws HibernateException
Query
setParameterList
in interface Query
name
- the name of the parametervals
- a collection of values to list
HibernateException
public String[] getNamedParameters() throws HibernateException
Query
getNamedParameters
in interface Query
HibernateException
public Query setProperties(Object bean) throws HibernateException
Query
setProperties
in interface Query
bean
- any JavaBean or POJO
HibernateException
public Query setParameterList(String name, Object[] vals, Type type) throws HibernateException
Query
setParameterList
in interface Query
name
- the name of the parametervals
- a collection of values to listtype
- the Hibernate type of the values
HibernateException
public Query setParameterList(String name, Object[] vals) throws HibernateException
Query
setParameterList
in interface Query
name
- the name of the parametervals
- a collection of values to list
HibernateException
public Object uniqueResult() throws HibernateException
Query
uniqueResult
in interface Query
HibernateException
- if there is more than one matching resultpublic int executeUpdate() throws HibernateException
Query
executeUpdate
in interface Query
HibernateException
protected RowSelection getRowSelection()
public Type[] typeArray()
public Object[] valueArray()
public QueryParameters getQueryParameters(Map namedParams)
protected abstract Map getLockModes()
public Query setCacheable(boolean cacheable)
Query
setCacheable
in interface Query
cacheable
- Should the query results be cacheable?public Query setCacheRegion(String cacheRegion)
Query
setCacheRegion
in interface Query
cacheRegion
- the name of a query cache region, or null
for the default query cachepublic Query setComment(String comment)
Query
setComment
in interface Query
comment
- a human-readable stringpublic String toString()
protected void before()
protected void after()
public Query setCollectionKey(Serializable collectionKey)
public Query setParameters(Object[] values, Type[] types)
Query
setParameters
in interface Query
public boolean isReadOnly()
public Query setReadOnly(boolean readOnly)
Query
setReadOnly
in interface Query
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |