background image

Conditional Expressions

<< WHERE Clause | BETWEEN Expressions >>
<< WHERE Clause | BETWEEN Expressions >>

Conditional Expressions

Enum Literals
The Java Persistence Query Language supports the use of enum literals using the Java enum
literal syntax. The enum class name must be specified as fully qualified class name.
SELECT e
FROM Employee e
WHERE e.status = com.xyz.EmployeeStatus.FULL_TIME
Input Parameters
An input parameter can be either a named parameter or a positional parameter.
A named input parameter is designated by a colon (:) followed by a string. For example, :name.
A positional input parameter is designated by a question mark (?) followed by an integer. For
example, the first input parameter is ?1, the second is ?2, and so forth.
The following rules apply to input parameters:
They can be used only in a WHERE or HAVING clause.
Positional parameters must be numbered, starting with the integer 1.
Named parameters and positional parameters may not be mixed in a single query.
Named parameters are case-sensitive.
Conditional Expressions
A WHERE clause consists of a conditional expression, which is evaluated from left to right within
a precedence level. You can change the order of evaluation by using parentheses.
Operators and Their Precedence
Table 27­2
lists the query language operators in order of decreasing precedence.
TABLE 27­2
Query Language Order Precedence
Type
Precedence Order
Navigation
.
(a period)
Arithmetic
+ ­
(unary)
* /
(multiplication and division)
+ ­
(addition and subtraction)
Full Query Language Syntax
The Java EE 5 Tutorial · September 2007
752