public abstract class Query<T>
extends java.lang.Object
implements org.springframework.orm.hibernate3.HibernateCallback
Definitions instance, which can optionally (and
 perhaps preferably) be static, which must be passed into the super
 constructor along with the Parameters provided during
 lookup.
 
 Queries can optionally define a enableFilters(Session) method
 (perhaps using pre-defined filters like
 ownerOrGroupFilters(Session, String[], String[]) to limit the entities
 returned.
 
| Modifier and Type | Field and Description | 
|---|---|
| protected Definitions | defscontainer of  QueryParameterDefinstances. | 
| protected static org.hibernate.FetchMode | FETCHimported constant for ease of use | 
| protected static int | INNER_JOINimported constant for ease of use | 
| protected static int | LEFT_JOINimported constant for ease of use | 
| protected java.util.Set<java.lang.String> | newlyEnabledFiltersthe set of filters that is being or has been enabled for this Query. | 
| protected ome.parameters.Parameters | paramscontainer of  QueryParameterinstances. | 
| Constructor and Description | 
|---|
| Query(Definitions definitions,
     ome.parameters.Parameters parameters)main constructor used by subclasses. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected abstract void | buildQuery(org.hibernate.Session session)main point of entry for subclasses. | 
| boolean | check(java.lang.String name) | 
| protected void | checkParameters()check the  Parametersinstance against theDefinitionsinstance for this Query. | 
| protected void | disableFilters(org.hibernate.Session session)turns the filters off that are listed in  newlyEnabledFilters | 
| Query<T> | disableQueryCache()Disable the Hibernate level 2 cache for this query. | 
| java.lang.Object | doInHibernate(org.hibernate.Session session)template method defined by  HibernateTemplate. | 
| protected void | enableFilters(org.hibernate.Session session)does nothing by default, but can be overridden by subclasses to enable
 particular filters. | 
| Query<T> | enableQueryCache()Enable the Hibernate level 2 cache for this query. | 
| ome.parameters.QueryParameter | get(java.lang.String name)get the  QueryParameterfor this name argument. | 
| protected void | ownerOrGroupFilters(org.hibernate.Session session,
                   java.lang.String[] ownerFilters,
                   java.lang.String[] groupFilters)standard filter used by many subclasses which uses the
  Parameters.isExperimenter()andParameters.isGroup()booleans to see if a filter should be turned on. | 
| protected void | setCriteria(org.hibernate.Criteria criteria)provide this Query instance with a  Criteriato be
 used for retrieving data. | 
| protected void | setQuery(org.hibernate.Query query)provide this Query instance with a  Queryto be used
 for retrieving data. | 
| void | setTimeout(int seconds) | 
| java.lang.Object | value(java.lang.String name)get the Object value for this name argument. | 
protected static final org.hibernate.FetchMode FETCH
FetchMode.JOINprotected static final int LEFT_JOIN
CriteriaSpecification.LEFT_JOIN, 
Constant Field Valuesprotected static final int INNER_JOIN
CriteriaSpecification.INNER_JOIN, 
Constant Field Valuesprotected final Definitions defs
QueryParameterDef instances. Typically created
 statically in Query subclasses and passed to the
 Query(Definitions, Parameters) constructorprotected final ome.parameters.Parameters params
QueryParameter instances. These must at least cover
 all the QueryParameterDefs defined for this Query but
 can define more. Other special fields of Parameters, such as a
 Filter instance can also be used by Query
 instances.protected java.util.Set<java.lang.String> newlyEnabledFilters
public Query(Definitions definitions, ome.parameters.Parameters parameters)
definitions - Not null.parameters - Not null.protected void checkParameters()
Parameters instance against the Definitions
 instance for this Query. Can be extended by subclasses, but
 super.checkParameters() should most likely be called.public boolean check(java.lang.String name)
public ome.parameters.QueryParameter get(java.lang.String name)
QueryParameter for this name argument.public java.lang.Object value(java.lang.String name)
public java.lang.Object doInHibernate(org.hibernate.Session session)
                               throws org.hibernate.HibernateException,
                                      java.sql.SQLException
HibernateTemplate.
 This does not need to be overridden by subclasses, but rather
 buildQuery(Session).
 This ensures that the filters are set properly, that
 buildQuery(Session) does its job, and that everything is cleaned
 up properly afterwards.
 
 It also enforces contracts established by Parameters and
 FilterdoInHibernate in interface org.springframework.orm.hibernate3.HibernateCallbackorg.hibernate.HibernateExceptionjava.sql.SQLExceptionprotected abstract void buildQuery(org.hibernate.Session session)
                            throws org.hibernate.HibernateException,
                                   java.sql.SQLException
Criteria or a Query instance
 and make it available via setCriteria(org.hibernate.Criteria) or
 setQuery(org.hibernate.Query)org.hibernate.HibernateExceptionjava.sql.SQLExceptionprotected void setQuery(org.hibernate.Query query)
Query to be used
 for retrieving data. setCriteria(org.hibernate.Criteria) should
 not also be called with a non-null value.protected void setCriteria(org.hibernate.Criteria criteria)
Criteria to be
 used for retrieving data. setQuery(org.hibernate.Query) should
 not also be called with a non-null value.public void setTimeout(int seconds)
seconds - the timeout to setprotected void enableFilters(org.hibernate.Session session)
protected void ownerOrGroupFilters(org.hibernate.Session session,
                                   java.lang.String[] ownerFilters,
                                   java.lang.String[] groupFilters)
Parameters.isExperimenter() and Parameters.isGroup()
 booleans to see if a filter should be turned on. If both booleans are
 active, group wins. The constant Parameters.OWNER_ID or
 Parameters.GROUP_ID is then used to define a filter.protected void disableFilters(org.hibernate.Session session)
newlyEnabledFilterspublic Query<T> enableQueryCache()