Skip to content

Commit 0640fe5

Browse files
committed
Document that fluent findBy(…) queries must return a result.
Closes #3237
1 parent 27670b0 commit 0640fe5

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

src/main/java/org/springframework/data/querydsl/QuerydslPredicateExecutor.java

+4
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ public interface QuerydslPredicateExecutor<T> {
115115
/**
116116
* Returns entities matching the given {@link Predicate} applying the {@link Function queryFunction} that defines the
117117
* query and its result type.
118+
* <p>
119+
* The query object used with {@code queryFunction} is only valid inside the `findBy(…)` method call. This requires
120+
* the query function to return a query result and not the {@link FluentQuery} object itself to ensure the query is
121+
* executed inside the {@code findBy(…)} method.
118122
*
119123
* @param predicate must not be {@literal null}.
120124
* @param queryFunction the query function defining projection, sorting, and the result type

src/main/java/org/springframework/data/querydsl/ReactiveQuerydslPredicateExecutor.java

+4
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ public interface ReactiveQuerydslPredicateExecutor<T> {
136136
/**
137137
* Returns entities matching the given {@link Predicate} applying the {@link Function queryFunction} that defines the
138138
* query and its result type.
139+
* <p>
140+
* The query object used with {@code queryFunction} is only valid inside the `findBy(…)` method call. This requires
141+
* the query function to return a query result and not the {@link FluentQuery} object itself to ensure the query is
142+
* executed inside the {@code findBy(…)} method.
139143
*
140144
* @param predicate must not be {@literal null}.
141145
* @param queryFunction the query function defining projection, sorting, and the result type

src/main/java/org/springframework/data/repository/query/QueryByExampleExecutor.java

+4
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ public interface QueryByExampleExecutor<T> {
9595
/**
9696
* Returns entities matching the given {@link Example} applying the {@link Function queryFunction} that defines the
9797
* query and its result type.
98+
* <p>
99+
* The query object used with {@code queryFunction} is only valid inside the `findBy(…)` method call. This requires
100+
* the query function to return a query result and not the {@link FluentQuery} object itself to ensure the query is
101+
* executed inside the {@code findBy(…)} method.
98102
*
99103
* @param example must not be {@literal null}.
100104
* @param queryFunction the query function defining projection, sorting, and the result type

src/main/java/org/springframework/data/repository/query/ReactiveQueryByExampleExecutor.java

+4
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ public interface ReactiveQueryByExampleExecutor<T> {
8484
/**
8585
* Returns entities matching the given {@link Example} applying the {@link Function queryFunction} that defines the
8686
* query and its result type.
87+
* <p>
88+
* The query object used with {@code queryFunction} is only valid inside the `findBy(…)` method call. This requires
89+
* the query function to return a query result and not the {@link FluentQuery} object itself to ensure the query is
90+
* executed inside the {@code findBy(…)} method.
8791
*
8892
* @param example must not be {@literal null}.
8993
* @param queryFunction the query function defining projection, sorting, and the result type

0 commit comments

Comments
 (0)