From 0e4d6de9c6e52a08a24f9e1c329d51528d301db9 Mon Sep 17 00:00:00 2001 From: Jens Schauder Date: Wed, 16 Jun 2021 09:15:09 +0200 Subject: [PATCH 1/2] module-specific-include - Prepare branch --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 526ad136a5..d2a458e0aa 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.springframework.data spring-data-commons - 2.6.0-SNAPSHOT + 2.6.0-module-specific-include-SNAPSHOT Spring Data Core From 861ed496270a2880b523b56b645ba27ffd3406d9 Mon Sep 17 00:00:00 2001 From: Jens Schauder Date: Tue, 15 Jun 2021 15:21:07 +0200 Subject: [PATCH 2/2] Allow for a module specific inclusion for DTO projections. See https://github.com/spring-projects/spring-data-jpa/issues/2009 --- src/main/asciidoc/repository-projections.adoc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/asciidoc/repository-projections.adoc b/src/main/asciidoc/repository-projections.adoc index 9b70c408d1..722c0df788 100644 --- a/src/main/asciidoc/repository-projections.adoc +++ b/src/main/asciidoc/repository-projections.adoc @@ -34,7 +34,7 @@ interface PersonRepository extends Repository { ==== Now imagine that we want to retrieve the person's name attributes only. -What means does Spring Data offer to achieve this? The rest of this chapter answers that question. +What means does Spring Data offer to achieve this?The rest of this chapter answers that question. [[projections.interfaces]] == Interface-based Projections @@ -264,17 +264,22 @@ class NamesOnly { You can dramatically simplify the code for a DTO by using https://projectlombok.org[Project Lombok], which provides an `@Value` annotation (not to be confused with Spring's `@Value` annotation shown in the earlier interface examples). If you use Project Lombok's `@Value` annotation, the sample DTO shown earlier would become the following: -[source, java] +[source,java] ---- @Value class NamesOnly { String firstname, lastname; } ---- + Fields are `private final` by default, and the class exposes a constructor that takes all fields and automatically gets `equals(…)` and `hashCode()` methods implemented. ==== +ifdef::repository-projections-dto-limitations-file[] +include::{repository-projections-dto-limitations-file}[] +endif::[] + [[projection.dynamic]] == Dynamic Projections @@ -284,7 +289,7 @@ To apply dynamic projections, use a query method such as the one shown in the fo .A repository using a dynamic projection parameter ==== -[source, java, subs="+attributes"] +[source,java,subs="+attributes"] ---- interface PersonRepository extends Repository {