background image

NULL Values

<< String Expressions | SELECT Clause >>
<< String Expressions | SELECT Clause >>

NULL Values

The ABS function takes a numeric expression and returns a number of the same type as the
argument.
The MOD function returns the remainder of the first argument divided by the second.
The SQRT function returns the square root of a number.
The SIZE function returns an integer of the number of elements in the given collection.
NULL Values
If the target of a reference is not in the persistent store, then the target is NULL. For conditional
expressions containing NULL, the query language uses the semantics defined by SQL92. Briefly,
these semantics are as follows:
If a comparison or arithmetic operation has an unknown value, it yields a NULL value.
Two NULL values are not equal. Comparing two NULL values yields an unknown value.
The IS NULL test converts a NULL persistent field or a single-valued relationship field to TRUE.
The IS NOT NULL test converts them to FALSE.
Boolean operators and conditional tests use the three-valued logic defined by
Table 27­6
and
Table 27­7
. (In these tables, T stands for TRUE, F for FALSE, and U for unknown.)
TABLE 27­6
AND
Operator Logic
AND
T
F
U
T
T
F
U
F
F
F
F
U
U
F
U
TABLE 27­7
OR
Operator Logic
OR
T
F
U
T
T
T
T
F
T
F
U
U
T
U
U
Equality Semantics
In the query language, only values of the same type can be compared. However, this rule has one
exception: Exact and approximate numeric values can be compared. In such a comparison, the
required type conversion adheres to the rules of Java numeric promotion.
Full Query Language Syntax
The Java EE 5 Tutorial · September 2007
758