clause of an EJB QL query is used to specify conditional logic that
is used to select a subset of the beans references in the
FROM clause. Any beans that you want to refer to
in your conditional query logic must be declared in the
FROM clause of the query.
The syntax of the
WHERE clause mirrors the syntax
WHERE clauses. The
clause is made up of literals and variables composed into various
conditional expressions. The variables used in a
WHERE clause can be query variables declared in
FROM clause, path expressions derived from the
query variables, or input parameters provided in the arguments to the
corresponding finder or select method. The conditional expressions in
WHERE clause can be composed using arithmetic
operators, comparison operators, or logical operators.
Literals are either strings, numeric values, or boolean values. String literals are enclosed in single quotes:
SELECT OBJECT(p) FROM ProfileBean p WHERE p.name = 'Fred'
If you want to include a single quote in a literal, use two single quotes:
SELECT OBJECT(p) FROM ProfileBean p WHERE p.name = 'Fred''s profile'
Numeric literals can be either exact integer values or approximate floating-point values. Integer values are specified using a sequence of digits with no decimal point:
SELECT OBJECT(prof) FROM ProfileBean prof WHERE prof.id < 1000
Floating-point values are specified using either scientific notation or a numeric value with a decimal point:
SELECT OBJECT(p) FROM ...