@@ -181,9 +181,9 @@ interface TestRepository extends CrudRepository<TestEntity, Long> { // <.>
181
181
182
182
List<ExtendedTestEntity> findAllExtendedEntities(); // <.>
183
183
184
- List<TestEntityInterfaceProjection> findAllInterfaceProjections (); // <.>
184
+ List<TestEntityInterfaceProjection> findAllInterfaceProjectionsBy (); // <.>
185
185
186
- List<TestEntityDTOProjection> findAllDTOProjections (); // <.>
186
+ List<TestEntityDTOProjection> findAllDTOProjectionsBy (); // <.>
187
187
188
188
@Query("MATCH (t:TestEntity) - [r:RELATED_TO] -> () RETURN t, COUNT(r) AS numberOfRelations") // <.>
189
189
List<TestEntityDTOProjection> findAllDTOProjectionsWithCustomQuery();
@@ -195,13 +195,15 @@ interface TestRepository extends CrudRepository<TestEntity, Long> { // <.>
195
195
of the extending class. The domain type of the method in question will be the extended class, which
196
196
still satisfies the domain type of the repository itself
197
197
<.> This method returns an interface projection, the return type of the method is therefore different
198
- from the repository's domain type. The interface can only access properties defined in the domain type
198
+ from the repository's domain type. The interface can only access properties defined in the domain type.
199
+ The suffix `By` is needed to make SDN not look for a property called `InterfaceProjections` in the `TestEntity`
199
200
<.> This method returns a DTO projection. Executing it will cause SDN to issue a warning, as the DTO defines
200
201
`numberOfRelations` as additional attribute, which is not in the contract of the domain type.
201
202
The annotated attribute `aProperty` in `TestEntity` will be correctly translated to `a_property` in the query.
202
203
As above, the return type is different from the repositories' domain type.
204
+ The suffix `By` is needed to make SDN not look for a property called `DTOProjections` in the `TestEntity`
203
205
<.> This method also returns a DTO projection. However, no warning will be issued, as the query contains a fitting
204
- value for the additional attributes defined in the projection.
206
+ value for the additional attributes defined in the projection
205
207
206
208
TIP: While the repository in <<projections.simple-entity-repository,the listing above>> uses a concrete return type to
207
209
define the projection, another variant is the use of <<projection.dynamic,dynamic projections>> as explained in the
0 commit comments