org.hibernate.ejb
Class AbstractQueryImpl<X>

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

public abstract class AbstractQueryImpl<X>
extends Object
implements javax.persistence.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.

Author:
Steve Ebersole

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 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()
           
 javax.persistence.FlushModeType getFlushMode()
           
 Map<String,Object> getHints()
          
abstract  javax.persistence.LockModeType getLockMode()
           
 int getMaxResults()
           
 Object getParameterValue(int position)
          
<T> T
getParameterValue(javax.persistence.Parameter<T> param)
          
 Object getParameterValue(String name)
          
protected  javax.persistence.FlushModeType getSpecifiedFlushMode()
           
 int getSpecifiedMaxResults()
           
 Set<String> getSupportedHints()
           
protected abstract  int internalExecuteUpdate()
          Actually execute the update; all pre-requisites have been checked.
 boolean isBound(javax.persistence.Parameter<?> param)
          
protected  void registerParameterBinding(javax.persistence.Parameter parameter, Object value)
           
 javax.persistence.TypedQuery<X> setFirstResult(int firstResult)
           
 javax.persistence.TypedQuery<X> setFlushMode(javax.persistence.FlushModeType jpaFlushMode)
           
 javax.persistence.TypedQuery<X> setHint(String hintName, Object value)
          
abstract  javax.persistence.TypedQuery<X> setLockMode(javax.persistence.LockModeType lockModeType)
           
 javax.persistence.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 javax.persistence.Query

applyMaxResults

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

Parameters:
maxResults - The specified max results

setMaxResults

public javax.persistence.TypedQuery<X> setMaxResults(int maxResult)

Specified by:
setMaxResults in interface javax.persistence.Query
Specified by:
setMaxResults in interface javax.persistence.TypedQuery<X>

getSpecifiedMaxResults

public int getSpecifiedMaxResults()

getMaxResults

public int getMaxResults()
Specified by:
getMaxResults in interface javax.persistence.Query

applyFirstResult

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

Parameters:
firstResult - The specified first-result value.

setFirstResult

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

getFirstResult

public int getFirstResult()
Specified by:
getFirstResult in interface javax.persistence.Query

getHints

public Map<String,Object> getHints()

Specified by:
getHints in interface javax.persistence.Query

applyTimeout

protected abstract void applyTimeout(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 javax.persistence.TypedQuery<X> setHint(String hintName,
                                               Object value)

Specified by:
setHint in interface javax.persistence.Query
Specified by:
setHint in interface javax.persistence.TypedQuery<X>

getSupportedHints

public Set<String> getSupportedHints()

setLockMode

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

getLockMode

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

setFlushMode

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

getSpecifiedFlushMode

protected javax.persistence.FlushModeType getSpecifiedFlushMode()

getFlushMode

public javax.persistence.FlushModeType getFlushMode()
Specified by:
getFlushMode in interface javax.persistence.Query

registerParameterBinding

protected void registerParameterBinding(javax.persistence.Parameter parameter,
                                        Object value)

isBound

public boolean isBound(javax.persistence.Parameter<?> param)

Specified by:
isBound in interface javax.persistence.Query

getParameterValue

public <T> T getParameterValue(javax.persistence.Parameter<T> param)

Specified by:
getParameterValue in interface javax.persistence.Query

getParameterValue

public Object getParameterValue(String name)

Specified by:
getParameterValue in interface javax.persistence.Query

getParameterValue

public Object getParameterValue(int position)

Specified by:
getParameterValue in interface javax.persistence.Query


Copyright © 2002-2011 Red Hat Middleware, LLC. All Rights Reserved