org.hibernate.ejb
Class AbstractQueryImpl<X>

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

public abstract class AbstractQueryImpl<X>
extends Object
implements TypedQuery<X>

Intended as a base class providing convenience in implementing both Query and TypedQuery.

IMPL NOTE : This issue, and the reason for this distinction, is that criteria and hl.sql queries share no commonality currently in Hibernate internals.


Constructor Summary
AbstractQueryImpl(HibernateEntityManagerImplementor entityManager)
           
 
Method Summary
protected abstract  void applyAliasSpecificLockMode(String alias, LockMode lockMode)
           
protected abstract  void applyCacheable(boolean isCacheable)
           
protected abstract  void applyCacheMode(CacheMode cacheMode)
           
protected abstract  void applyCacheRegion(String regionName)
           
protected abstract  void applyComment(String comment)
           
protected abstract  void applyFetchSize(int fetchSize)
           
protected abstract  void applyFirstResult(int firstResult)
          Apply the given first-result value.
protected abstract  void applyFlushMode(FlushMode flushMode)
           
protected abstract  void applyLockTimeout(int timeout)
           
protected abstract  void applyMaxResults(int maxResults)
          Apply the given max results value.
protected abstract  void applyReadOnly(boolean isReadOnly)
           
protected abstract  void applyTimeout(int timeout)
           
protected abstract  boolean canApplyLockModes()
           
 int executeUpdate()
           
protected  HibernateEntityManagerImplementor getEntityManager()
           
 int getFirstResult()
           
 FlushModeType getFlushMode()
           
 Map<String,Object> getHints()
           
abstract  LockModeType getLockMode()
           
 int getMaxResults()
           
 Object getParameterValue(int position)
           
<T> T
getParameterValue(Parameter<T> param)
           
 Object getParameterValue(String name)
           
protected  FlushModeType getSpecifiedFlushMode()
           
 int getSpecifiedMaxResults()
           
 Set<String> getSupportedHints()
           
protected abstract  int internalExecuteUpdate()
          Actually execute the update; all pre-requisites have been checked.
 boolean isBound(Parameter<?> param)
           
protected  void registerParameterBinding(Parameter parameter, Object value)
           
 TypedQuery<X> setFirstResult(int firstResult)
           
 TypedQuery<X> setFlushMode(FlushModeType jpaFlushMode)
           
 TypedQuery<X> setHint(String hintName, Object value)
           
abstract  TypedQuery<X> setLockMode(LockModeType lockModeType)
           
 TypedQuery<X> setMaxResults(int maxResult)
           
 
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
getResultList, getSingleResult, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter, setParameter
 
Methods inherited from interface javax.persistence.Query
getParameter, getParameter, getParameter, getParameter, getParameters, unwrap
 

Constructor Detail

AbstractQueryImpl

public AbstractQueryImpl(HibernateEntityManagerImplementor entityManager)
Method Detail

getEntityManager

protected HibernateEntityManagerImplementor getEntityManager()

internalExecuteUpdate

protected abstract int internalExecuteUpdate()
Actually execute the update; all pre-requisites have been checked.

Returns:
The number of "affected rows".

executeUpdate

public int executeUpdate()
Specified by:
executeUpdate in interface Query

applyMaxResults

protected abstract void applyMaxResults(int maxResults)
Apply the given max results value.

Parameters:
maxResults - The specified max results

setMaxResults

public TypedQuery<X> setMaxResults(int maxResult)
Specified by:
setMaxResults in interface Query
Specified by:
setMaxResults in interface TypedQuery<X>

getSpecifiedMaxResults

public int getSpecifiedMaxResults()

getMaxResults

public int getMaxResults()
Specified by:
getMaxResults in interface Query

applyFirstResult

protected abstract void applyFirstResult(int firstResult)
Apply the given first-result value.

Parameters:
firstResult - The specified first-result value.

setFirstResult

public TypedQuery<X> setFirstResult(int firstResult)
Specified by:
setFirstResult in interface Query
Specified by:
setFirstResult in interface TypedQuery<X>

getFirstResult

public int getFirstResult()
Specified by:
getFirstResult in interface Query

getHints

public Map<String,Object> getHints()
Specified by:
getHints in interface Query

applyTimeout

protected abstract void applyTimeout(int timeout)

applyLockTimeout

protected abstract void applyLockTimeout(int timeout)

applyComment

protected abstract void applyComment(String comment)

applyFetchSize

protected abstract void applyFetchSize(int fetchSize)

applyCacheable

protected abstract void applyCacheable(boolean isCacheable)

applyCacheRegion

protected abstract void applyCacheRegion(String regionName)

applyReadOnly

protected abstract void applyReadOnly(boolean isReadOnly)

applyCacheMode

protected abstract void applyCacheMode(CacheMode cacheMode)

applyFlushMode

protected abstract void applyFlushMode(FlushMode flushMode)

canApplyLockModes

protected abstract boolean canApplyLockModes()

applyAliasSpecificLockMode

protected abstract void applyAliasSpecificLockMode(String alias,
                                                   LockMode lockMode)

setHint

public TypedQuery<X> setHint(String hintName,
                             Object value)
Specified by:
setHint in interface Query
Specified by:
setHint in interface TypedQuery<X>

getSupportedHints

public Set<String> getSupportedHints()

setLockMode

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

getLockMode

public abstract LockModeType getLockMode()
Specified by:
getLockMode in interface Query

setFlushMode

public TypedQuery<X> setFlushMode(FlushModeType jpaFlushMode)
Specified by:
setFlushMode in interface Query
Specified by:
setFlushMode in interface TypedQuery<X>

getSpecifiedFlushMode

protected FlushModeType getSpecifiedFlushMode()

getFlushMode

public FlushModeType getFlushMode()
Specified by:
getFlushMode in interface Query

registerParameterBinding

protected void registerParameterBinding(Parameter parameter,
                                        Object value)

isBound

public boolean isBound(Parameter<?> param)
Specified by:
isBound in interface Query

getParameterValue

public <T> T getParameterValue(Parameter<T> param)
Specified by:
getParameterValue in interface Query

getParameterValue

public Object getParameterValue(String name)
Specified by:
getParameterValue in interface Query

getParameterValue

public Object getParameterValue(int position)
Specified by:
getParameterValue in interface Query


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