138 Queries with JDOQL Table 8.2 Comparative operators
Query filter expressions 139 8.5.3 Differences between JDOQL and Java operators There are a number of differences between the usage of these operators in JDOQL and their usage in Java. Many of the differences serve to streamline the query language, making it more intuitive. 8.5.3.1 Method invocation JDOQL is a language for querying persistent instances from a data store. It is not, as some people have believed, a fully fledged object query language. This is borne out by the restriction that method invocations are largely illegal in JDOQL filters. This restriction means that a JDO implementation is not required to instantiate an instance in order to determine whether it matches the given query filter criteria. Query performance is therefore greatly improved. Four legal method invocations are defined. The filter may apply the following invocations to persistent fields of Collection type: isEmpty() Returns true if the persistent field is null or references a Collection that con tains no elements. contains(Object o) Returns true if the persistent field references a Collection that contains the identified persistence-capable object. The object o must be a persistence-capable instance. Equality between persistent instances always uses JDO identity, and is irrespective of any equals() method that may be defined. Conceptually the contains(Object o) method is used to iterate the local variable o over the elements of a Collection. It is used as the left-hand side of a boolean expression, and evaluates to true if any one element of the Collection satisfies that expression. The filter may apply the following invocations to persistent fields of String type: startsWith(String s) Returns true if the persistent field to which the method is applied starts with the designated string. endsWith(String s) Returns true if the persistent field to which the method is applied ends with the designated string. Vendors may add support for other method invocations as long as these are non- mutating. A non-mutating method is one that does not alter the state of any objects. Such additions will be well documented, but should not be considered portable across implementations. A few vendors are already supporting the String methods indexOf()and toLower(), with support for further invocations to follow.
Note: If you are looking for inexpensive but high quality provider to host and run your jsp application check Astra jsp hosting services