From b00220b50d789b1926f55df7fb7b3360d0486755 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Thu, 29 Aug 2024 10:07:39 +0200 Subject: [PATCH] Reorder documentation of class-based projection support for JPA Native Queries. Closes #3599 --- .../modules/ROOT/pages/repositories/projections.adoc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/antora/modules/ROOT/pages/repositories/projections.adoc b/src/main/antora/modules/ROOT/pages/repositories/projections.adoc index d34f5f5f56..556eebe91f 100644 --- a/src/main/antora/modules/ROOT/pages/repositories/projections.adoc +++ b/src/main/antora/modules/ROOT/pages/repositories/projections.adoc @@ -1,9 +1,17 @@ [[jpa.projections]] = Projections -include::{commons}@data-commons::page$repositories/projections.adoc[leveloffset=+1] +:projection-collection: Collection + +include::{commons}@data-commons::page$repositories/projections-intro.adoc[] NOTE: It is important to note that <> with JPQL is limited to *constructor expressions* in your JPQL expression, e.g. `SELECT new com.example.NamesOnly(u.firstname, u.lastname) from User u`. (Note the usage of a FQDN for the DTO type!) This JPQL expression can be used in `@Query` annotations as well where you define any named queries. And it's important to point out that class-based projections do not work with native queries AT ALL. As a workaround you may use named queries with `ResultSetMapping` or the Hibernate-specific javadoc:{hibernatejavadocurl}org.hibernate.query.ResultListTransformer[] + +include::{commons}@data-commons::page$repositories/projections-interface.adoc[leveloffset=1] + +include::{commons}@data-commons::page$repositories/projections-class.adoc[leveloffset=1] + +