130 Queries with JDOQL The philosophy of JDOQL

130 Queries with JDOQL The philosophy of JDOQL revolves around the concept of a so-called candidate collection of instances to which the query s filter criteria will be applied. The result of query execution is an unmodifiable Collection, comprised of those members of the candidate collection for which the filter criteria evaluated to true. Queries can include parameterized values. They can also define and use local reference variables to which values are assigned during query execution, and by which the query filter may traverse connected instances. Queries consist of the following mandatory elements: . The candidate class. All instances of the candidate collection will be instances of this class. The unmodifiable collection returned after query execution will contain only instances of the candidate class. Polymorphism is fully supported, so instances of implicitly includes any subclasses of the candidate class. . The candidate collection. This may be a true Collection object containing zero or more objects, all of which must be instances of the candidate class. Alternatively this may be the Extent of the candidate class, implicitly including all persistent instances as candidates for the query. (The extent may optionally include or exclude subclasses of the candidate class.) . The query filter. This is expressed as a Java-like boolean expression. The result of query execution will include only those candidates for which the expression evaluates to true. Queries may additionally contain: . parameter declarations, comprising one or more pairs of identifier names and types; . parameter values, provided at execution time, which are bound to the declared parameter identifiers. Values are usually assigned to declared identifiers as positional parameters, but can also be passed as named parameters depending on the application s requirements; . variable declarations, comprising one or more pairs of identifier names and types. Variables are typically used to hold references that allow query filters to span graphs of connected instances; . import declarations, used to import non-standard class names that are to be used as types for parameters or variables; . an ordering specification allowing arbitrary ordering of the query results. Queries also include the notion of namespaces. A given identifier name may not be defined more than once in a particular namespace. There are two name- spaces for each query: . Type Namespace. All type names used by the query reside in this namespace. Thus a query may not use two different types that have the same name. The candidate class and all public types in the java.lang package are implicitly imported into this namespace. Other types must be imported explicitly as required through the import declaration for the query.
Note: If you are looking for good and quality webspace to host and run your java application check Actions java hosting services

Comments are closed.