|
Provides methods for directly querying object graphs. As far as is
possible, IQuery should be considered the lowest level DB-access
(SELECT) interface.
Unlike the IUpdate interface, using other methods
will most likely not leave the database in an inconsistent state,
but may provide stale data in some situations.
By convention, all methods that begin with get
will
never return a null or empty java::util::Collection, but
instead will throw a ValidationException.
Looks up an entity by class and id. If no such object exists, an exception will be thrown.
an initialized entity
Looks up an entity by class and id. If no such objects
exists, return a null
.
an initialized entity or null if id doesn't exist.
Looks up all entities that belong to this class and match filter.
a collection if initialized entities or an empty List if none exist.
Searches based on provided example entity. The example
entity should uniquely specify the entity or an
exception will be thrown.
Note: findByExample does not operate on the id
field. For that, use {@code find}, {@code get},
{@code findByQuery}, or {@code findAllByQuery}.
Possibly null IObject result.
Searches based on provided example entity. The returned
entities will be limited by the sys::Filter
object.
Note: findAllbyExample does not operate on the
id
field.
For that, use {@code find}, {@code get},
{@code findByQuery}, or {@code findAllByQuery}.
Possibly empty List of IObject results.
Searches a given field matching against a String. Method does not allow for case sensitive or insensitive searching since this is essentially a lookup. The existence of more than one result will result in an exception. {@code omero.model.Project.NAME}
found entity or possibly null.
Searches a given field matching against a String. Method allows for case sensitive or insensitive searching using the (I)LIKE comparators. Result set will be reduced by the sys::Filter instance. {@code omero.model.Project.NAME}. Not null.
A list (possibly empty) with the results.
Executes the stored query with the given name. If a query with the name cannot be found, an exception will be thrown. The queryName parameter can be an actual query String if the StringQuerySource is configured on the server and the user running the query has proper permissions.
Possibly null IObject result.
Executes the stored query with the given name. If a query with the name cannot be found, an exception will be thrown. The queryName parameter can be an actual query String if the StringQuerySource is configured on the server and the user running the query has proper permissions. Queries can only return lists of model::IObject instances. This means all must be of the form:
select this from SomeModelClass this ...though the alias this is unimportant. Do not try to return multiple classes in one call like:
select this, that from SomeClass this, SomeOtherClass that ...nor to project values out of an object:
select this.name from SomeClass this ...If a page is desired, add it to the query parameters.
Possibly empty List of IObject results.
Executes a full text search based on Lucene. Each term in the query can also be prefixed by the name of the field to which is should be restricted. Examples:
A list of loaded model::IObject instances. Never null.
Return a sequence of RType sequences.
Each element of the outer sequence is one row in the return value. Each element of the inner sequence is one column specified in the HQL.
model::IObject instances are returned wrapped in an RObject instance. Primitives are mapped to the expected RType subclass. Types without an RType mapper if returned will throw an exception if present in the select except where a manual conversion is present on the server. This includes:
As with SQL, if an aggregation statement is used, a group by clause must be added.
Examples:
select i.name, i.description from Image i where i.name like '%.dv' select tag.textValue, tagset.textValue from TagAnnotation tag join tag.annotationLinks l join l.child tagset select p.pixelsType.value, count(p.id) from Pixel p group by p.pixelsType.value
Refreshes an entire model::IObject graph, recursive loading all data for the managed instances in the graph from the database. If any non-managed entities are detected (e.g. without ids), an ApiUsageException will be thrown.
a similar model::IObject graph (with possible additions and deletions) which is in-sync with the database.
|