Skip to content

Commit 0cd99ce

Browse files
schaudermp911de
authored andcommitted
Allow for a module specific inclusion for DTO projections.
See spring-projects/spring-data-jpa#2009 See #2382
1 parent c24ba26 commit 0cd99ce

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/asciidoc/repository-projections.adoc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ interface PersonRepository extends Repository<Person, UUID> {
3434
====
3535

3636
Now imagine that we want to retrieve the person's name attributes only.
37-
What means does Spring Data offer to achieve this? The rest of this chapter answers that question.
37+
What means does Spring Data offer to achieve this?The rest of this chapter answers that question.
3838

3939
[[projections.interfaces]]
4040
== Interface-based Projections
@@ -264,17 +264,22 @@ class NamesOnly {
264264
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).
265265
If you use Project Lombok's `@Value` annotation, the sample DTO shown earlier would become the following:
266266
267-
[source, java]
267+
[source,java]
268268
----
269269
@Value
270270
class NamesOnly {
271271
String firstname, lastname;
272272
}
273273
----
274+
274275
Fields are `private final` by default, and the class exposes a constructor that takes all fields and automatically gets `equals(…)` and `hashCode()` methods implemented.
275276
276277
====
277278

279+
ifdef::repository-projections-dto-limitations-file[]
280+
include::{repository-projections-dto-limitations-file}[]
281+
endif::[]
282+
278283
[[projection.dynamic]]
279284
== Dynamic Projections
280285

@@ -284,7 +289,7 @@ To apply dynamic projections, use a query method such as the one shown in the fo
284289

285290
.A repository using a dynamic projection parameter
286291
====
287-
[source, java, subs="+attributes"]
292+
[source,java,subs="+attributes"]
288293
----
289294
interface PersonRepository extends Repository<Person, UUID> {
290295

0 commit comments

Comments
 (0)