このコンテンツは選択した言語では利用できません。
12.4.13. About HQL Predicates
Predicates form the basis of the where clause, the having clause and searched case expressions. They are expressions which resolve to a truth value, generally
TRUE
or FALSE
, although boolean comparisons involving NULLs generally resolve to UNKNOWN
.
HQL Predicates
- Nullness Predicate
- Check a value for nullness. Can be applied to basic attribute references, entity references and parameters. HQL additionally allows it to be applied to component/embeddable types.
Example 12.14. Nullness Checking Examples
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Like Predicate
- Performs a like comparison on string values. The syntax is:
like_expression ::= string_expression [NOT] LIKE pattern_value [ESCAPE escape_character]
like_expression ::= string_expression [NOT] LIKE pattern_value [ESCAPE escape_character]
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The semantics follow that of the SQL like expression. Thepattern_value
is the pattern to attempt to match in thestring_expression
. Just like SQL,pattern_value
can use "_" and "%" as wildcards. The meanings are the same. "_" matches any single character. "%" matches any number of characters.The optionalescape_character
is used to specify an escape character used to escape the special meaning of "_" and "%" in thepattern_value
. This is useful when needing to search on patterns including either "_" or "%".Example 12.15. Like Predicate Examples
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Between Predicate
- Analogous to the SQL
BETWEEN
expression. Perform a evaluation that a value is within the range of 2 other values. All the operands should have comparable types.Example 12.16. Between Predicate Examples
Copy to Clipboard Copied! Toggle word wrap Toggle overflow