2.17.2: 2011-06-17

net.sf.basedb.core.hibernate
Class EntityQueryWrapper

java.lang.Object
  extended by net.sf.basedb.core.hibernate.QueryWrapper
      extended by net.sf.basedb.core.hibernate.EntityQueryWrapper
All Implemented Interfaces:
org.hibernate.Query

public class EntityQueryWrapper
extends QueryWrapper

Wraps a hibernate query and adds checks so that unsaved items aren't added to the query as parameters. This is normally not detected until the query is executed. By wrapping a query with this class the same situation is detected immediately when adding the parameter to the query, which makes it easier to find problems.

Version:
2.5
Author:
nicklas
Last modified
$Date: 2008-09-11 22:11:02 +0200 (Thu, 11 Sep 2008) $

Field Summary
 
Fields inherited from class net.sf.basedb.core.hibernate.QueryWrapper
query
 
Constructor Summary
EntityQueryWrapper(org.hibernate.Query query)
           
 
Method Summary
private  void checkEntity(IdentifiableData entity)
           
private  void checkEntityArray(Object[] values)
           
private  void checkEntityCollection(Collection values)
           
 org.hibernate.Query setEntity(int position, Object val)
           
 org.hibernate.Query setEntity(String name, Object val)
           
 org.hibernate.Query setParameter(int position, Object val)
           
 org.hibernate.Query setParameter(int position, Object val, org.hibernate.type.Type type)
           
 org.hibernate.Query setParameter(String name, Object val)
           
 org.hibernate.Query setParameter(String name, Object val, org.hibernate.type.Type type)
           
 org.hibernate.Query setParameterList(String name, Collection vals)
           
 org.hibernate.Query setParameterList(String name, Collection vals, org.hibernate.type.Type type)
           
 org.hibernate.Query setParameterList(String name, Object[] vals)
           
 org.hibernate.Query setParameterList(String name, Object[] vals, org.hibernate.type.Type type)
           
 
Methods inherited from class net.sf.basedb.core.hibernate.QueryWrapper
executeUpdate, getNamedParameters, getQueryString, getReturnAliases, getReturnTypes, isReadOnly, iterate, list, scroll, scroll, setBigDecimal, setBigDecimal, setBigInteger, setBigInteger, setBinary, setBinary, setBoolean, setBoolean, setByte, setByte, setCacheable, setCacheMode, setCacheRegion, setCalendar, setCalendar, setCalendarDate, setCalendarDate, setCharacter, setCharacter, setComment, setDate, setDate, setDouble, setDouble, setFetchSize, setFirstResult, setFloat, setFloat, setFlushMode, setInteger, setInteger, setLocale, setLocale, setLockMode, setLockOptions, setLong, setLong, setMaxResults, setParameters, setProperties, setProperties, setReadOnly, setResultTransformer, setSerializable, setSerializable, setShort, setShort, setString, setString, setText, setText, setTime, setTime, setTimeout, setTimestamp, setTimestamp, uniqueResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityQueryWrapper

public EntityQueryWrapper(org.hibernate.Query query)
Method Detail

setEntity

public org.hibernate.Query setEntity(int position,
                                     Object val)
Specified by:
setEntity in interface org.hibernate.Query
Overrides:
setEntity in class QueryWrapper

setEntity

public org.hibernate.Query setEntity(String name,
                                     Object val)
Specified by:
setEntity in interface org.hibernate.Query
Overrides:
setEntity in class QueryWrapper

setParameter

public org.hibernate.Query setParameter(int position,
                                        Object val)
                                 throws org.hibernate.HibernateException
Specified by:
setParameter in interface org.hibernate.Query
Overrides:
setParameter in class QueryWrapper
Throws:
org.hibernate.HibernateException

setParameter

public org.hibernate.Query setParameter(String name,
                                        Object val)
                                 throws org.hibernate.HibernateException
Specified by:
setParameter in interface org.hibernate.Query
Overrides:
setParameter in class QueryWrapper
Throws:
org.hibernate.HibernateException

setParameter

public org.hibernate.Query setParameter(int position,
                                        Object val,
                                        org.hibernate.type.Type type)
Specified by:
setParameter in interface org.hibernate.Query
Overrides:
setParameter in class QueryWrapper

setParameter

public org.hibernate.Query setParameter(String name,
                                        Object val,
                                        org.hibernate.type.Type type)
Specified by:
setParameter in interface org.hibernate.Query
Overrides:
setParameter in class QueryWrapper

setParameterList

public org.hibernate.Query setParameterList(String name,
                                            Collection vals)
                                     throws org.hibernate.HibernateException
Specified by:
setParameterList in interface org.hibernate.Query
Overrides:
setParameterList in class QueryWrapper
Throws:
org.hibernate.HibernateException

setParameterList

public org.hibernate.Query setParameterList(String name,
                                            Object[] vals)
                                     throws org.hibernate.HibernateException
Specified by:
setParameterList in interface org.hibernate.Query
Overrides:
setParameterList in class QueryWrapper
Throws:
org.hibernate.HibernateException

setParameterList

public org.hibernate.Query setParameterList(String name,
                                            Collection vals,
                                            org.hibernate.type.Type type)
                                     throws org.hibernate.HibernateException
Specified by:
setParameterList in interface org.hibernate.Query
Overrides:
setParameterList in class QueryWrapper
Throws:
org.hibernate.HibernateException

setParameterList

public org.hibernate.Query setParameterList(String name,
                                            Object[] vals,
                                            org.hibernate.type.Type type)
                                     throws org.hibernate.HibernateException
Specified by:
setParameterList in interface org.hibernate.Query
Overrides:
setParameterList in class QueryWrapper
Throws:
org.hibernate.HibernateException

checkEntity

private void checkEntity(IdentifiableData entity)

checkEntityCollection

private void checkEntityCollection(Collection values)

checkEntityArray

private void checkEntityArray(Object[] values)

2.17.2: 2011-06-17