fix minor errors in queries in querylanguage doc

This commit is contained in:
Gavin King 2023-06-05 22:10:04 +02:00 committed by Christian Beikov
parent 8fbb62ade8
commit ca2b33c2be
3 changed files with 5 additions and 1 deletions

View File

@ -1170,6 +1170,7 @@ from Author where books is empty
[[member-of-collection-predicate-example]] [[member-of-collection-predicate-example]]
[source, hql] [source, hql]
---- ----
select author, book
from Author as author, Book as book from Author as author, Book as book
where author member of book.authors where author member of book.authors
---- ----

View File

@ -53,7 +53,7 @@ Then Hibernate will query every entity which inherits the named type.
[[root-reference-jpql-fqn-example]] [[root-reference-jpql-fqn-example]]
[source, hql] [source, hql]
---- ----
select doc from org.hibernate.example.AbstractDocument where text like :pattern select doc from org.hibernate.example.AbstractDocument as doc where doc.text like :pattern
---- ----
Of course, there may be multiple root entities. Of course, there may be multiple root entities.
@ -349,6 +349,7 @@ An explicit join may narrow the type of the joined entity using `treat()`.
from Order as ord from Order as ord
join treat(ord.payments as CreditCardPayment) as creditCardPayment join treat(ord.payments as CreditCardPayment) as creditCardPayment
where length(creditCardPayment.cardNumber) between 16 and 20 where length(creditCardPayment.cardNumber) between 16 and 20
select ord.id, creditCardPayment.cardNumber, creditCardPayment.amount
---- ----
Here, the identification variable `ccp` declared to the right of `treat()` has the narrowed type `CreditCardPayment`, instead of the declared type `Payment`. Here, the identification variable `ccp` declared to the right of `treat()` has the narrowed type `CreditCardPayment`, instead of the declared type `Payment`.

View File

@ -942,6 +942,7 @@ with Tree as (
join Node child on child.parent.id = parent.id join Node child on child.parent.id = parent.id
) search depth first by id set level /* depth-first search */ ) search depth first by id set level /* depth-first search */
from Tree from Tree
select text
order by level order by level
---- ----
@ -962,6 +963,7 @@ with Tree as (
join Node child on child.parent.id = parent.id join Node child on child.parent.id = parent.id
) search breadth first by id set level /* breadth-first search */ ) search breadth first by id set level /* breadth-first search */
from Tree from Tree
select text
order by level desc order by level desc
---- ----