Object Retrieval and Queries

Home > Object Persistency API > API Reference > Object Retrieval and Queries

Two different possibilities exist to find entities in the database.

  • You are allowed to use the first one, namely resolve, but it is mainly targeted to dynamically interconnect entities behind the scenes.
  • The second alternative, find and execute, is the more interesting part, where you can execute arbitrary queries with a generic query language.

resolve

You can find a certain entity by passing the object identifier (OID). Though an OID is unique in the whole system you additionally pass the extent to search through. This results in better performance which is crucial for this kind of finder as it is heavily used to dynamically interconnect entities behind the scenes.

You can find a set/list of certain entities by passing a set/list of OIDs. Again you specify the extent to search through due to performance issues.

package org.oomega.core;

public interface EOResolver {
    public <T extends EntityObject> T resolve(CId<T> cid, OId oid);
    public <T extends EntityObject> Set<T> resolve(CId<T> cid, Set<? extends OId> oids);
    public <T extends EntityObject> List<T> resolve(CId<T> cid, List<? extends OId> oids);
}

Please note that the EOContainerSession interface inherits these methods from EOResolver.

find / execute

You can specify an arbitrary query with a powerful and generic query language. The details of the query language are described in chapter Query Language. The constructed query can be passed to the execute method.

The find method offers a subset of the query language. It is a shortcut for searching within a certain class extent utilizing only a WHERE condition, i.e. a predicate.

package org.oomega.persistence;

public interface EOContainerSession extends EOResolver, SecurityContext, StreamingContext, TXContext {
    public Collection execute(Query query);
    public <EO extends EntityObject> Set<EO> find(CId<EO> cid, Predicate predicate);
}

Next chapter: Read and Update Objects

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.