-
Book Overview & Buying
-
Table Of Contents
EJB 3 Developer Guide
By :
The WHERE clause is used to filter results. For example,
SELECT c FROM Customer c WHERE c.lastName = 'PAGE'
retrieves only those Customer entities with lastName equal to'PAGE'.
A large number of constructs are provided for constructing conditional expressions that make up a WHERE clause.
More than one condition can be used in a WHERE clause by means of the AND operator:
SELECT c FROM Customer c WHERE c.lastName = 'KING' AND c.firstName = 'SIMON'
As well the = (equal) operator JPQL provides the following comparison operators:
>, >=, <, <=, <> (not equal).
The IS NULL operator tests whether or not a single-valued path expression is a NULL value:
SELECT ad FROM Address ad WHERE ad.postCode IS NULL
There is a negated version of the operator, NOT NULL as in:
SELECT ad FROM Address ad WHERE ad.postCode IS NOT NULL
The BETWEEN operator is used for checking whether a value is within a given range. BETWEEN is inclusive, so in the query:
SELECT ac FROM...
Change the font size
Change margin width
Change background colour