2.10.2.5.15. JPQL Collection Member Expressions
The syntax for the use of the comparison operator MEMBER OF in an collection_member_expression is as follows:
-
collection_member_expression ::= entity_or_value_expression [NOT] MEMBER [OF] collection_valued_path_expression
-
entity_or_value_expression ::= single_valued_object_path_expression | state_field_path_expression | simple_entity_or_value_expression
-
simple_entity_or_value_expression ::= identification_variable | input_parameter | literal
This expression tests whether the designated value is a member of the collection specified by the collection-valued path expression.
Expressions that evaluate to embeddable types are not supported in collection member expressions.
If the collection valued path expression designates an empty collection, the value of the
MEMBER OF expression is FALSE and the value of the NOT MEMBER OF expression is TRUE.
Otherwise, if the value of the collection_valued_path_expression or entity_or_value_expression in the collection member expression is NULL or unknown, the value of the collection member expression is unknown.
The use of the reserved word OF is optional in this expression.
Example:
SELECT p
FROM Person p
WHERE 'Joe' MEMBER OF p.nicknames