The filter expression is a String containing a Boolean expression evaluated for each instance of the candidate class. If the filter is not specified, it defaults to true. Rules for constructing valid expressions follow the Java language, with the following differences:
Equality and ordering comparisons between primitives and instances of wrapper classes are valid.
Equality and ordering comparisons of Date fields and Date parameters are valid.
Equality and ordering comparisons of String fields and String parameters are valid.
White space (non-printing characters space, tab, carriage return, and line feed) is a separator and is otherwise ignored.
The following assignment operators are not supported.
Comparison operators such as =, +=, and so on
Pre- and post-increment
Pre- and post-decrement
Methods, including object construction, are not supported, except for these methods.
Collection.contains(Object o) Collection.isEmpty() String.startsWith(String s) String.endsWith(String e)
In addition, the GlassFish Server supports the following nonstandard JDOQL methods.
String.like(String pattern) String.like(String pattern, char escape) String.substring(int start, int length) String.indexOf(String str) String.indexOf(String str, int start) String.length() Math.abs(numeric n) Math.sqrt(double d)
Navigation through a null-valued field, which throws a NullPointerException, is treated as if the sub-expression returned false.
Comparisons between floating point values are by nature inexact. Therefore, equality comparisons (== and !=) with floating point values should be used with caution. Identifiers in the expression are considered to be in the name space of the candidate class, with the addition of declared parameters and variables. As in the Java language, this is a reserved word, and refers to the current instance being evaluated.
The following expressions are supported.
Relational operators (==, !=, >, <, >=, <=)
Boolean operators (&, &&, |, ||, ~, !)
Arithmetic operators (+, -, *, /)
String concatenation, only for String + String
Parentheses to explicitly mark operator precedence
Promotion of numeric operands for comparisons and arithmetic operations
The rules for promotion follow the Java rules extended by BigDecimal, BigInteger, and numeric wrapper classes. See the numeric promotions of the Java language specification.