Package ome.services.query

facilitates the creation of Hibernate Queries and Criteria.

See:
          Description

Class Summary
AbstractClassIdsOptionsQuery simple abstract class that provides a common Definitions containing: IdsQueryParameterDef, ome.services.query.OptionsQueryParameterDef, and ClassQueryParameterDef.
ClassQuerySource creates a query based on the id string by interpreting it as a Class.
CollectionCountQueryDefinition counts the number of members in a collection.
CollectionQueryParameterDef extension of QueryParameterDef which restricts the type to a Collection, and specifies the element types of that Collection.
Definitions container for QueryParameterDef instances.
Hierarchy single-point of entry for walking of OME container hierarchies.
IObjectClassQuery simple query subclass which uses the Parameters.CLASS parameter value to create a Criteria and then adds Expression instances based on all other parameter names.
NullQuerySource always returns null for any id.
PojosFindAnnotationsQueryDefinition  
PojosFindHierarchiesQueryDefinition walks up the hierarchy tree starting at Image nodes while fetching various information.
PojosGetImagesByOptionsQueryDefinition  
PojosGetImagesQueryDefinition  
PojosGetUserImagesQueryDefinition  
PojosLoadHierarchyQueryDefinition  
Query<T> base Query type to facilitate the creation of ORM queries.
QueryFactory query locator which is configured by Spring.
QueryParameterDef definition of a slot into which a QueryParameter must fit.
QuerySource contract for any source of queries.
StringQuery simple HQL query.
StringQuerySource interprets the query id as an HQL query.
 

Exception Summary
QueryException something failed in looking up a query
 

Package ome.services.query Description

facilitates the creation of Hibernate Queries and Criteria.

ORM solutions like Hibernate, TopLink, and JDO provide mechanisms for storing queries by name for faster lookups. Producing parameterizable queries, however, is far more difficult. The query package intends to make writing such queries as easy as possible.

Effort has been placed into making certain activities, like walking (and fetching) OME hierarchies simpler. These queries are used heavily by the IContainer interface. Also, having this work available in code rather than the Strings of previous methods (XML files, Velocity templates, etc.) allows for significantly more reuse and easier re-factoring.

A second design goal is allowing clients to write queries themselves. Parameters allow for the passing of arbitrary arguments (like named arguments in dynamic languages), and the QueryFactory#lookup mechanism allows for a wide variety of client-definition styles. Probably the most useful is the saving of a QueryDefinition using IUpdate, and the subsequent lookup referring to the queryName. (NYI)

Examples

QueryFactory factory = new QueryFactory(new StringQuerySource()); Query q = factory.lookup("select p from Project p",null); List allProjects = (List) iQuery.execute( q ); QueryFactory factory = new QueryFactory(new ClassNameSource()); Query subclassQ = factory.lookup(PojosFindAnnotationsQueryDefinition.class.getName(), new Parameters().addIds(Collections.singleton(1L)).addClass(Image.class)); Query datasetQ = factory.lookup(Dataset.class, new Parameters( new Filter().unique() ).addString("name","16.3093-A93")); List imageAnnotations = (List) iQuery.execute( subclassQ ); Dataset dataset = (Dataset) iQuery.execute(datasetQ);

Related Documentation

For more information, please see:

See Also:
IContainer, LocalQuery, Criteria, Query


OmeroJava Api

Version: 4.3.4-dbcbce5a-b4

Copyright © 2009 The University of Dundee. All Rights Reserved.