Browse Source

Document restrictions of simple base-repository method overrides in regard to projections.

Closes #2473
2.5.x
Mark Paluch 4 years ago
parent
commit
f87ae360df
No known key found for this signature in database
GPG Key ID: 4406B84C1661DCD1
  1. 2
      src/main/asciidoc/repository-projections.adoc

2
src/main/asciidoc/repository-projections.adoc

@ -69,6 +69,8 @@ interface PersonRepository extends Repository<Person, UUID> { @@ -69,6 +69,8 @@ interface PersonRepository extends Repository<Person, UUID> {
The query execution engine creates proxy instances of that interface at runtime for each element returned and forwards calls to the exposed methods to the target object.
NOTE: Declaring a method in your `Repository` that overrides a base method (e.g. declared in `CrudRepository`, a store-specific repository interface, or the `Simple…Repository`) results in a call to the base method regardless of the declared return type. Make sure to use a compatible return type as base methods cannot be used for projections. Some store modules support `@Query` annotations to turn an overridden base method into a query method that then can be used to return projections.
[[projections.interfaces.nested]]
Projections can be used recursively. If you want to include some of the `Address` information as well, create a projection interface for that and return that interface from the declaration of `getAddress()`, as shown in the following example:

Loading…
Cancel
Save