Home

JDOQL

JDOQL, the Java Data Objects Query Language, is the standard query language for Java Data Objects (JDO). It enables applications to query persistence-capable objects stored in a datastore. JDOQL operates on the persistent fields and relationships of registered classes rather than on database tables and columns. The syntax resembles SQL but uses Java class names and property names. A typical query begins with SELECT FROM <ClassName> and may include a WHERE clause and an ORDER BY clause, with optional use of parameters.

Queries are created and executed through the JDO API via a PersistenceManager. A query targets a candidate

Example: SELECT FROM com.example.Person WHERE age > 21

This returns instances of com.example.Person satisfying the predicate. Another form uses parameters: declareParameters("int minAge"); SELECT FROM

JDOQL is designed to be portable across JDO implementations and datastores that support JDO. It emphasizes

Limitations and extensions vary by implementation; some support aggregates, grouping, and distinct results, while others focus

class,
and
conditions
in
the
WHERE
clause
reference
field
values,
object
relationships,
and
collection
contents.
Parameter
binding
is
supported,
usually
by
declaring
parameter
types
and
supplying
values
at
execution
time.
com.example.Person
WHERE
age
>
minAge;
Collection<Person>
results
=
(Collection<Person>)
q.execute(18);
object
navigation
over
SQL-style
joins,
with
joins
expressed
by
traversing
object
relationships
in
path
expressions.
It
also
supports
querying
on
fields
within
related
objects
and
on
collection-valued
fields.
on
basic
filtering
and
ordering.
For
specifics,
consult
the
JDO
specification
and
the
documentation
of
the
particular
JDO
implementation
in
use.