The Design of JDO s Query Service


The Design of JDO's Query Service

JDO's query service has two parts, the Query interface and the query language (JDOQL). The syntax and semantics of JDOQL are similar to the syntax and semantics of Java, except that JDOQL has a smaller syntax that is less type constrained than Java. The JDO implementation can perform the query in memory, or it can translate the query into the native query language and interface of the datastore. JDO permits the implementation to support additional query languages. While support for additional query languages is optional, support for JDOQL is required.

JDO supports queries on extents of persistent objects in the datastore. It also supports queries on collections of persistent objects in memory. The JDO implementation may use the datastore's native query language and interface, or it may use its own query logic. Most implementations have both capabilities. The implementation is expected to support large results sets. JDO does not favor the capabilities of any particular datastore, but most JDO implementations optimize query execution for the datastore that they target. The JDO query service allows queries to be compiled for better performance.

JDO and its query capabilities are firmly rooted in the object model of the data classes. JDOQL provides the ability to compare field values and navigate references and collections. With these capabilities, powerful queries can be constructed in JDOQL. These queries are simple for Java programmers to create and understand because they are based on the application data classes and on a query language that is similar to Java.

A complete query language for the data classes would include every query that could be executed by manipulating the classes. Although powerful, JDOQL is not a complete query language. One limitation is the inability to navigate arrays contained within the application data class. A more important limitation is the inability to invoke the methods of the application data class. Because methods cannot be invoked, JDOQL cannot refer to an application data class as an implementation of an interface. The inability to call methods arises because most datastores save only the object's state and not its behavior.




Using and Understanding Java Data Objects
Using and Understanding Java Data Objects
ISBN: 1590590430
EAN: 2147483647
Year: 2005
Pages: 156
Authors: David Ezzio

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net