org.hibernate.ejb
Class QueryImpl<X>

java.lang.Object
  extended by org.hibernate.ejb.AbstractQueryImpl<X>
      extended by org.hibernate.ejb.QueryImpl<X>
All Implemented Interfaces:
Query, TypedQuery<X>, HibernateQuery

public class QueryImpl<X>
extends AbstractQueryImpl<X>
implements TypedQuery<X>, HibernateQuery

Hibernate implementation of both the Query and TypedQuery contracts.

Author:
Gavin King, Emmanuel Bernard, Steve Ebersole

Constructor Summary
QueryImpl(Query query, AbstractEntityManagerImpl em)
           
QueryImpl(Query query, AbstractEntityManagerImpl em, Map<String,Class> namedParameterTypeRedefinitions)
           
 
Method Summary
protected  void applyAliasSpecificLockMode(String alias, LockMode lockMode)
           
protected  void applyCacheable(boolean isCacheable)
           
protected  void applyCacheMode(CacheMode cacheMode)
           
protected  void applyCacheRegion(String regionName)
           
protected  void applyComment(String comment)
           
protected  void applyFetchSize(int fetchSize)
           
protected  void applyFirstResult(int firstResult)
          Apply the given first-result value.
protected  void applyFlushMode(FlushMode flushMode)
           
protected  void applyMaxResults(int maxResults)
          Apply the given max results value.
protected  void applyReadOnly(boolean isReadOnly)
           
protected  void applyTimeout(int timeout)
           
protected  boolean canApplyLockModes()
           
 Query getHibernateQuery()
           
 LockModeType getLockMode()
           
 Parameter<?> getParameter(int position)
          
<T> Parameter<T>
getParameter(int position, Class<T> type)
          
 Parameter<?> getParameter(String name)
          
<T> Parameter<T>
getParameter(String name, Class<T> type)
          
 Set<Parameter<?>> getParameters()
          
 List<X> getResultList()
          
 X getSingleResult()
          
protected  int internalExecuteUpdate()
          Actually execute the update; all pre-requisites have been checked.
 TypedQuery<X> setLockMode(LockModeType lockModeType)
           
 TypedQuery<X> setParameter(int position, Calendar value, TemporalType temporalType)
          
 TypedQuery<X> setParameter(int position, Date value, TemporalType temporalType)
          
 TypedQuery<X> setParameter(int position, Object value)
          
 TypedQuery<X> setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType)
           
 TypedQuery<X> setParameter(Parameter<Date> param, Date value, TemporalType temporalType)
           
<T> TypedQuery<X>
setParameter(Parameter<T> param, T value)
           
 TypedQuery<X> setParameter(String name, Calendar value, TemporalType temporalType)
          
 TypedQuery<X> setParameter(String name, Date value, TemporalType temporalType)
          
 TypedQuery<X> setParameter(String name, Object value)
          
<T> T
unwrap(Class<T> tClass)
          
 
Methods inherited from class org.hibernate.ejb.AbstractQueryImpl
executeUpdate, getEntityManager, getFirstResult, getFlushMode, getHints, getMaxResults, getParameterValue, getParameterValue, getParameterValue, getSpecifiedFlushMode, getSpecifiedMaxResults, getSupportedHints, isBound, registerParameterBinding, setFirstResult, setFlushMode, setHint, setMaxResults
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.persistence.TypedQuery
setFirstResult, setFlushMode, setHint, setMaxResults
 
Methods inherited from interface javax.persistence.Query
executeUpdate, getFirstResult, getFlushMode, getHints, getMaxResults, getParameterValue, getParameterValue, getParameterValue, isBound
 

Constructor Detail

QueryImpl

public QueryImpl(Query query,
                 AbstractEntityManagerImpl em)

QueryImpl

public QueryImpl(Query query,
                 AbstractEntityManagerImpl em,
                 Map<String,Class> namedParameterTypeRedefinitions)
Method Detail

getHibernateQuery

public Query getHibernateQuery()
Specified by:
getHibernateQuery in interface HibernateQuery

internalExecuteUpdate

protected int internalExecuteUpdate()
Description copied from class: AbstractQueryImpl
Actually execute the update; all pre-requisites have been checked.

Specified by:
internalExecuteUpdate in class AbstractQueryImpl<X>
Returns:
The number of "affected rows".

applyMaxResults

protected void applyMaxResults(int maxResults)
Description copied from class: AbstractQueryImpl
Apply the given max results value.

Specified by:
applyMaxResults in class AbstractQueryImpl<X>
Parameters:
maxResults - The specified max results

applyFirstResult

protected void applyFirstResult(int firstResult)
Description copied from class: AbstractQueryImpl
Apply the given first-result value.

Specified by:
applyFirstResult in class AbstractQueryImpl<X>
Parameters:
firstResult - The specified first-result value.

applyTimeout

protected void applyTimeout(int timeout)
Specified by:
applyTimeout in class AbstractQueryImpl<X>

applyComment

protected void applyComment(String comment)
Specified by:
applyComment in class AbstractQueryImpl<X>

applyFetchSize

protected void applyFetchSize(int fetchSize)
Specified by:
applyFetchSize in class AbstractQueryImpl<X>

applyCacheable

protected void applyCacheable(boolean isCacheable)
Specified by:
applyCacheable in class AbstractQueryImpl<X>

applyCacheRegion

protected void applyCacheRegion(String regionName)
Specified by:
applyCacheRegion in class AbstractQueryImpl<X>

applyReadOnly

protected void applyReadOnly(boolean isReadOnly)
Specified by:
applyReadOnly in class AbstractQueryImpl<X>

applyCacheMode

protected void applyCacheMode(CacheMode cacheMode)
Specified by:
applyCacheMode in class AbstractQueryImpl<X>

applyFlushMode

protected void applyFlushMode(FlushMode flushMode)
Specified by:
applyFlushMode in class AbstractQueryImpl<X>

canApplyLockModes

protected boolean canApplyLockModes()
Specified by:
canApplyLockModes in class AbstractQueryImpl<X>

applyAliasSpecificLockMode

protected void applyAliasSpecificLockMode(String alias,
                                          LockMode lockMode)
Specified by:
applyAliasSpecificLockMode in class AbstractQueryImpl<X>

getResultList

public List<X> getResultList()

Specified by:
getResultList in interface Query
Specified by:
getResultList in interface TypedQuery<X>

getSingleResult

public X getSingleResult()

Specified by:
getSingleResult in interface Query
Specified by:
getSingleResult in interface TypedQuery<X>

setParameter

public <T> TypedQuery<X> setParameter(Parameter<T> param,
                                      T value)
Specified by:
setParameter in interface Query
Specified by:
setParameter in interface TypedQuery<X>

setParameter

public TypedQuery<X> setParameter(Parameter<Date> param,
                                  Date value,
                                  TemporalType temporalType)
Specified by:
setParameter in interface Query
Specified by:
setParameter in interface TypedQuery<X>

setParameter

public TypedQuery<X> setParameter(Parameter<Calendar> param,
                                  Calendar value,
                                  TemporalType temporalType)
Specified by:
setParameter in interface Query
Specified by:
setParameter in interface TypedQuery<X>

setParameter

public TypedQuery<X> setParameter(String name,
                                  Object value)

Specified by:
setParameter in interface Query
Specified by:
setParameter in interface TypedQuery<X>

setParameter

public TypedQuery<X> setParameter(String name,
                                  Date value,
                                  TemporalType temporalType)

Specified by:
setParameter in interface Query
Specified by:
setParameter in interface TypedQuery<X>

setParameter

public TypedQuery<X> setParameter(String name,
                                  Calendar value,
                                  TemporalType temporalType)

Specified by:
setParameter in interface Query
Specified by:
setParameter in interface TypedQuery<X>

setParameter

public TypedQuery<X> setParameter(int position,
                                  Object value)

Specified by:
setParameter in interface Query
Specified by:
setParameter in interface TypedQuery<X>

setParameter

public TypedQuery<X> setParameter(int position,
                                  Date value,
                                  TemporalType temporalType)

Specified by:
setParameter in interface Query
Specified by:
setParameter in interface TypedQuery<X>

setParameter

public TypedQuery<X> setParameter(int position,
                                  Calendar value,
                                  TemporalType temporalType)

Specified by:
setParameter in interface Query
Specified by:
setParameter in interface TypedQuery<X>

getParameters

public Set<Parameter<?>> getParameters()

Specified by:
getParameters in interface Query

getParameter

public Parameter<?> getParameter(String name)

Specified by:
getParameter in interface Query

getParameter

public Parameter<?> getParameter(int position)

Specified by:
getParameter in interface Query

getParameter

public <T> Parameter<T> getParameter(String name,
                                     Class<T> type)

Specified by:
getParameter in interface Query

getParameter

public <T> Parameter<T> getParameter(int position,
                                     Class<T> type)

Specified by:
getParameter in interface Query

unwrap

public <T> T unwrap(Class<T> tClass)

Specified by:
unwrap in interface Query

setLockMode

public TypedQuery<X> setLockMode(LockModeType lockModeType)
Specified by:
setLockMode in interface Query
Specified by:
setLockMode in interface TypedQuery<X>
Specified by:
setLockMode in class AbstractQueryImpl<X>

getLockMode

public LockModeType getLockMode()
Specified by:
getLockMode in interface Query
Specified by:
getLockMode in class AbstractQueryImpl<X>


Copyright © 2001-2010 Red Hat, Inc. All Rights Reserved.