Package ome.services.query

facilitates the creation of Hibernate Queries and Criteria.

See: Description

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: 5.1.4-ice35-b55

Copyright © 2015 The University of Dundee & Open Microscopy Environment. All Rights Reserved.