| org.odbms.Query
All known Subclasses: org.apache.ojb.soda.QueryImpl,
Query | public interface Query (Code) | | handle to a query graph and reference to a specific node.
The query graph consists of multiple nodes, each representing a
class or a member of a class. The structure can be linked in
any way that the class model used allows. A Query
object references a single node of this graph.
The graph can
be traversed with the functions descendant() and parent()
which return references to other nodes of the graph. These two
functions will automatically extend the graph, if necessary.
execute() evaluates the entire graph against the objects stored
in the data container. execute() can be called from any node of the
graph and will create an
ObjectSet filled with objects of the object type
that the node, it was called from, represents. Objects for all
descendant nodes of the caller Query object will be instantiated.
Objects of parent nodes will not be visible in the
ObjectSet if they are
not referenced from the caller Query object.
|
Method Summary | |
public Constraint | constrain(Object example) adds a constraint to this node. | public Query | descendant(String path) returns a reference to a descendant node in the query graph.
If the node does not exist, it will be created.
Path notation:
"[membername].[membername].[membername]"
(any number of members)
To request references to elements of multi-element objects like
arrays, lists, vectors, maps, hashMaps, ...:
"[membername].[membername].[membername]."
(Note the extra "." at the end.)
Parameters: path - path to the descendant. | public ObjectSet | execute() executes the query. | public Query | limitSize(int count) limits the maximum amount of objects returned.
Especially for sorted queries, large performance advantages are
possible.
Parameters: count - - the maximum amount of objects desired. | public Query | orderAscending() adds an ascending order criteria to this node of
the query graph. | public Query | orderDescending() adds a descending order criteria to this node of
the query graph. | public Query | parent(String path) returns a reference to a parent node in the query graph. |
constrain | public Constraint constrain(Object example)(Code) | | adds a constraint to this node.
If the object parameter is deeper than the entire query graph,
the query graph is extended accordingly.
Parameters: example - object for comparison Constraint |
descendant | public Query descendant(String path)(Code) | | returns a reference to a descendant node in the query graph.
If the node does not exist, it will be created.
Path notation:
"[membername].[membername].[membername]"
(any number of members)
To request references to elements of multi-element objects like
arrays, lists, vectors, maps, hashMaps, ...:
"[membername].[membername].[membername]."
(Note the extra "." at the end.)
Parameters: path - path to the descendant. "[membername].[membername]" Query descendant node - the member node at the end of thepath specified. |
execute | public ObjectSet execute()(Code) | | executes the query.
ObjectSet - the resultset of the Query |
limitSize | public Query limitSize(int count)(Code) | | limits the maximum amount of objects returned.
Especially for sorted queries, large performance advantages are
possible.
Parameters: count - - the maximum amount of objects desired. this Query to allow the chaining of method calls |
orderAscending | public Query orderAscending()(Code) | | adds an ascending order criteria to this node of
the query graph. In case of multiple calls to ordering
methods, the query graph is ordered by all criteria in the
order they were called.
this Query to allow the chaining of method calls |
orderDescending | public Query orderDescending()(Code) | | adds a descending order criteria to this node of
the query graph. In case of multiple calls to ordering
methods, the query graph is ordered by all criteria in the
order they were called.
this Query to allow the chaining of method calls |
parent | public Query parent(String path)(Code) | | returns a reference to a parent node in the query graph.
If the node does not exist, it will be created.
Path notation:
"[classname].[membername].[membername]"
where the last member is this Query node.
Parameters: path - to the parent node "[classname].[membername]" Query parent node - the class node at the beginning of thepath specified. |
|
|