Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for a module specific inclusion for DTO projections. #2382

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.6.0-SNAPSHOT</version>
<version>2.6.0-module-specific-include-SNAPSHOT</version>

<name>Spring Data Core</name>

Expand Down
11 changes: 8 additions & 3 deletions src/main/asciidoc/repository-projections.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface PersonRepository extends Repository<Person, UUID> {
====

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
Expand Down Expand Up @@ -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

Expand All @@ -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<Person, UUID> {

Expand Down