|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.orientechnologies.jdo.oQuery
Query implementation. It supports all languages supported by Orient (JDOQL and ORQL).
| Constructor Summary | |
oQuery(oPersistenceManager iManager)
Create an empty query passing the PersistenceManager associated. |
|
| Method Summary | |
void |
close(java.lang.Object p0)
Close a query result and release any resources associated with it. |
void |
closeAll()
Close all query results associated with this Query instance, and release all
resources associated with them. |
void |
compile()
Compile the query. |
void |
declareImports(java.lang.String parm1)
Set the import statements to be used to identify the fully qualified name of variables or parameters. |
void |
declareParameters(java.lang.String parm1)
Declare the list of parameters query execution. |
void |
declareVariables(java.lang.String parm1)
Declare the unbound variables to be used in the query. |
java.lang.Object |
execute()
Execute the query returning a collection with results or the persistent object if the query returns only one object. |
java.lang.Object |
execute(java.lang.Object parm1)
Execute the query and return the filtered Collection. |
java.lang.Object |
execute(java.lang.Object parm1,
java.lang.Object parm2)
Execute the query and return the filtered Collection. |
java.lang.Object |
execute(java.lang.Object parm1,
java.lang.Object parm2,
java.lang.Object parm3)
Execute the query and return the filtered Collection. |
java.lang.Object |
executeWithArray(java.lang.Object[] parm1)
Execute the query and return the filtered Collection.
|
java.lang.Object |
executeWithMap(java.util.Map parm1)
Execute the query and return the filtered Collection. |
boolean |
getIgnoreCache()
Returns always TRUE since cache is never accessed in query execution |
PersistenceManager |
getPersistenceManager()
Get the PersistenceManager associated with this Query.
|
boolean |
isPolymorphic()
Return polymorphic feature of query execution. |
void |
setCandidates(java.util.Collection parm1)
Set the candidate Collection to query. |
void |
setCandidates(Extent parm1)
Set the candidate Extent to query. |
void |
setClass(java.lang.Class iClass)
Set the class of the candidate instances of the query. |
void |
setClass(java.lang.String iClassName)
|
void |
setDatabase(java.lang.String iUrl)
|
void |
setFilter(java.lang.String iFilter)
Set the filter for the query. |
void |
setIgnoreCache(boolean iValue)
Set the ignoreCache option. |
void |
setOrdering(java.lang.String parm1)
Set the ordering specification for the result Collection. |
void |
setPolymorphic(boolean iValue)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public oQuery(oPersistenceManager iManager)
iManager - | Method Detail |
public void compile()
compile in interface Querypublic void declareImports(java.lang.String parm1)
QueryString with semicolon-separated
statements.
The String parameter to this method follows the syntax of the
import statement of the Java language.
declareImports in interface Queryparm1 - import statements separated by semicolons.public void declareParameters(java.lang.String parm1)
QueryString containing one or more query
parameter declarations separated with commas. Each parameter named
in the parameter declaration must be bound to a value when
the query is executed.
The String parameter to this method follows the syntax for formal
parameters in the Java language.
declareParameters in interface Queryparm1 - the list of parameters separated by commas.public void declareVariables(java.lang.String parm1)
QueryString
containing one or more unbound variable declarations separated
with semicolons. It follows the syntax for local variables in
the Java language.
declareVariables in interface Queryparm1 - the variables separated by semicolons.public java.lang.Object execute()
execute in interface Query#oResultSetpublic java.lang.Object execute(java.lang.Object parm1)
QueryCollection.
execute in interface Queryparm1 - the value of the first parameter declared.
Collection.Query.executeWithArray(Object[] parameters)
public java.lang.Object execute(java.lang.Object parm1,
java.lang.Object parm2)
QueryCollection.
execute in interface Queryparm1 - the value of the first parameter declared.parm2 - the value of the second parameter declared.
Collection.Query.executeWithArray(Object[] parameters)
public java.lang.Object execute(java.lang.Object parm1,
java.lang.Object parm2,
java.lang.Object parm3)
QueryCollection.
execute in interface Queryparm1 - the value of the first parameter declared.parm2 - the value of the second parameter declared.parm3 - the value of the third parameter declared.
Collection.Query.executeWithArray(Object[] parameters)public java.lang.Object executeWithArray(java.lang.Object[] parm1)
QueryCollection.
The execution of the query obtains the values of the parameters and matches them against the declared parameters in order. The names of the declared parameters are ignored. The type of the declared parameters must match the type of the passed parameters, except that the passed parameters might need to be unwrapped to get their primitive values.
The filter, import, declared parameters, declared variables, and ordering statements are verified for consistency.
Each element in the candidate Collection is examined to see that it
is assignment compatible to the Class of the query. It is then evaluated
by the Boolean expression of the filter. The element passes the filter
if there exist unique values for all variables for which the filter
expression evaluates to true.
executeWithArray in interface Queryparm1 - the Object array with all of the parameters.
Collection.public java.lang.Object executeWithMap(java.util.Map parm1)
QueryCollection. The query
is executed with the parameters set by the Map values. Each Map entry
consists of a key which is the name of the parameter in the
declareParameters method, and a value which is the value used in
the execute method. The keys in the Map and the declared parameters
must exactly match or a JDOUserException is thrown.
executeWithMap in interface Queryparm1 - the Map containing all of the parameters.
Collection.Query.executeWithArray(Object[] parameters)public boolean getIgnoreCache()
getIgnoreCache in interface QueryQuery.setIgnoreCache(boolean)public boolean isPolymorphic()
public void setPolymorphic(boolean iValue)
public PersistenceManager getPersistenceManager()
QueryPersistenceManager associated with this Query.
If this Query was restored from a serialized form, it has no
PersistenceManager, and this method returns null.
getPersistenceManager in interface QueryPersistenceManager associated with this Query.public void setCandidates(java.util.Collection parm1)
QueryCollection to query.
setCandidates in interface Queryparm1 - the candidate Collection.public void setCandidates(Extent parm1)
QueryExtent to query.
setCandidates in interface Queryparm1 - the candidate Extent.public void setDatabase(java.lang.String iUrl)
public void setClass(java.lang.Class iClass)
QueryThe class specifies the class
of the candidates of the query. Elements of the candidate collection
that are of the specified class are filtered before being
put into the result Collection.
setClass in interface QueryiClass - the Class of the candidate instances.public void setClass(java.lang.String iClassName)
public void setFilter(java.lang.String iFilter)
QueryThe filter specification is a String containing a Boolean
expression that is to be evaluated for each of the instances
in the candidate collection. If the filter is not specified,
then it defaults to "true", which has the effect of filtering
the input Collection only for class type.
An element of the candidate collection is returned in the result if:
Class of the Query; and
true.
The user may denote uniqueness in the filter expression by
explicitly declaring an expression (for example, e1 != e2).
Rules for constructing valid expressions follow the Java language, except for these differences:
Date fields and Date
parameters are valid.
=, +=, etc. and pre- and post-increment
and -decrement are not supported. Therefore, there are no side
effects from evaluation of any expressions.
Collection.contains(Object o), Collection.isEmpty(),
String.startsWith(String s), and String.endsWith(String e).
Implementations might choose to support non-mutating method
calls as non-standard extensions.
null-valued field, which would throw
NullPointerException, is treated as if the filter expression
returned false for the evaluation of the current set of variable
values. Other values for variables might still qualify the candidate
instance for inclusion in the result set.
Collection types) is
specified using a variable declaration and the
Collection.contains(Object o) method.
Identifiers in the expression are considered to be in the name
space of the specified class, with the addition of declared imports,
parameters and variables. As in the Java language, this is a reserved
word which means the element of the collection being evaluated.
Navigation through single-valued fields is specified by the Java
language syntax of field_name.field_name....field_name.
A JDO implementation is allowed to reorder the filter expression for optimization purposes.
setFilter in interface QueryiFilter - the query filter.public void setIgnoreCache(boolean iValue)
QueryPersistenceManagerFactory or the
PersistenceManager used to create this Query.
The ignoreCache option setting specifies whether the query should execute
entirely in the back end, instead of in the cache. If this flag is set
to true, an implementation might be able to optimize the query
execution by ignoring changed values in the cache. For optimistic
transactions, this can dramatically improve query response times.
setIgnoreCache in interface QueryiValue - the setting of the ignoreCache option.public void setOrdering(java.lang.String parm1)
QueryCollection. The
ordering specification is a String containing one or more ordering
declarations separated by commas.
Each ordering declaration is the name of the field on which
to order the results followed by one of the following words:
"ascending" or "descending".
The field must be declared in the candidate class or must be a navigation expression starting with a field in the candidate class.
Valid field types are primitive types except boolean; wrapper types
except Boolean; BigDecimal; BigInteger;
String; and Date.
setOrdering in interface Queryparm1 - the ordering specification.public void close(java.lang.Object p0)
Queryexecute(...) and might have iterators open on it.
Iterators associated with the query result are invalidated: they return false
to hasNext() and throw NoSuchElementException to next().
close in interface Queryp0 - the result of execute(...) on this Query instance.public void closeAll()
QueryQuery instance, and release all
resources associated with them. The query results might have iterators open
on them. Iterators associated with the query results are invalidated:
they return false to hasNext() and throw
NoSuchElementException to next().
closeAll in interface Query
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||