forked from spring-projects/spring-data-jpa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorder documentation of class-based projection support for JPA Nativ…
…e Queries. Closes spring-projects#3599
- Loading branch information
Showing
1 changed file
with
9 additions
and
1 deletion.
There are no files selected for viewing
10 changes: 9 additions & 1 deletion
10
src/main/antora/modules/ROOT/pages/repositories/projections.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <<projections.dtos,Class-based projections>> 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] | ||
|
||
|