HHH-16801 document 'is true', 'is not true', 'is false', 'is not false' operators

This commit is contained in:
Gavin King 2023-06-25 10:43:03 +02:00
parent 987a0dfe3c
commit 0126d96d03
2 changed files with 51 additions and 2 deletions

View File

@ -1133,13 +1133,14 @@ from Book where price between 1.0 and 100.0
==== Operators for dealing with null ==== Operators for dealing with null
The following operators make it easier to deal with null values. The following operators make it easier to deal with null values.
These predicates never evaluate to `null`.
[cols="20,20,15,~"] [cols="20,20,15,~"]
|=== |===
| Operator | Negation | Type | Semantics | Operator | Negation | Type | Semantics
| `is null` | `is not null` | Unary postfix | `true` if the value to the left is null | `is null` | `is not null` | Unary postfix | `true` if the value to the left is null, or false if it is not null
| `is distinct from` | `is not distinct from` | Binary | `true` if the value on the left is equal to the value on the right, or if both are null | `is distinct from` | `is not distinct from` | Binary | `true` if the value on the left is equal to the value on the right, or if both values are null, and false otherwise
|=== |===
[[null-predicate-example]] [[null-predicate-example]]
@ -1148,6 +1149,33 @@ The following operators make it easier to deal with null values.
from Author where nomDePlume is not null from Author where nomDePlume is not null
---- ----
[[boolean-predicate]]
==== Operators for dealing with boolean values
These operators perform comparisons on values of type `boolean`.
These predicates never evaluate to `null`.
[NOTE]
====
The values `true` and `false` of the `boolean` basic type are different to the logical `true` or `false` produced by a predicate.
====
For _logical_ operations on <<conditional-expressions,predicates>>, see <<logical-operators>> below.
[cols="20,20,15,~"]
|===
| Operator | Negation | Type | Semantics
| `is true` | `is not true` | Unary postfix | `true` if the value to the left is `true`, or `false` otherwise
| `is false` | `is not false` | Binary | `true` if the value to the left is `false`, or `false` otherwise
|===
[[null-predicate-example]]
[source, hql]
----
from Book where discontinued is not true
----
[[collection-operators]] [[collection-operators]]
==== Collection predicates ==== Collection predicates

View File

@ -1226,6 +1226,27 @@ include::{example-dir-hql}/HQLTest.java[tags=hql-null-predicate-example]
---- ----
==== ====
[[boolean-predicate]]
==== Operators for dealing with boolean values
These operators perform comparisons on values of type `boolean`.
These predicates never evaluate to `null`.
[NOTE]
====
The values `true` and `false` of the `boolean` basic type are different to the logical `true` or `false` produced by a predicate.
====
For _logical_ operations on <<conditional-expressions,predicates>>, see <<logical-operators>> below.
[cols="20,20,15,~"]
|===
| Operator | Negation | Type | Semantics
| `is true` | `is not true` | Unary postfix | `true` if the value to the left is `true`, or `false` otherwise
| `is false` | `is not false` | Binary | `true` if the value to the left is `false`, or `false` otherwise
|===
[[hql-like-predicate]] [[hql-like-predicate]]
==== String pattern matching ==== String pattern matching