You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<1> The `findByLastname` method shows a query for all people with the given last name.
133
+
<1> The method shows a query for all people with the given `lastname`. The query is derived by parsing the method name for constraints that can be concatenated with `And` and `Or`. Thus, the method name results in a query expression of `SELECT … FROM person WHERE firstname = :firstname`.
134
+
<2> The method shows a query for all people with the given `firstname` once the `firstname` is emitted by the given `Publisher`.
135
+
<3> Use `Pageable` to pass offset and sorting parameters to the database.
136
+
<4> Find a single entity for the given criteria. It completes with `IncorrectResultSizeDataAccessException` on non-unique results.
137
+
<5> Unless <4>, the first entity is always emitted even if the query yields more result documents.
138
+
<6> The `findByLastname` method shows a query for all people with the given last name.
117
139
The query is provided, as R2DBC repositories do not support query derivation.
118
-
<2> A query for a single `Person` entity projecting only `firstname` and `lastname` columns.
140
+
<7> A query for a single `Person` entity projecting only `firstname` and `lastname` columns.
119
141
The annotated query uses native bind markers, which are Postgres bind markers in this example.
120
142
====
121
143
122
-
NOTE: R2DBC repositories do not support query derivation.
144
+
The following table shows the keywords that are supported for query methods:
145
+
146
+
[cols="1,2,3", options="header", subs="quotes"]
147
+
.Supported keywords for query methods
148
+
|===
149
+
| Keyword
150
+
| Sample
151
+
| Logical result
152
+
153
+
| `After`
154
+
| `findByBirthdateAfter(Date date)`
155
+
| `birthdate > date`
156
+
157
+
| `GreaterThan`
158
+
| `findByAgeGreaterThan(int age)`
159
+
| `age > age`
160
+
161
+
| `GreaterThanEqual`
162
+
| `findByAgeGreaterThanEqual(int age)`
163
+
| `age >= age`
164
+
165
+
| `Before`
166
+
| `findByBirthdateBefore(Date date)`
167
+
| `birthdate < date`
168
+
169
+
| `LessThan`
170
+
| `findByAgeLessThan(int age)`
171
+
| `age < age`
172
+
173
+
| `LessThanEqual`
174
+
| `findByAgeLessThanEqual(int age)`
175
+
| `age <= age`
176
+
177
+
| `Between`
178
+
| `findByAgeBetween(int from, int to)`
179
+
| `age BETWEEN from AND to`
180
+
181
+
| `NotBetween`
182
+
| `findByAgeBetween(int from, int to)`
183
+
| `age NOT BETWEEN from AND to`
184
+
185
+
| `In`
186
+
| `findByAgeIn(Collection<Integer> ages)`
187
+
| `age IN (age1, age2, ageN)`
188
+
189
+
| `NotIn`
190
+
| `findByAgeNotIn(Collection ages)`
191
+
| `age NOT IN (age1, age2, ageN)`
192
+
193
+
| `IsNotNull`, `NotNull`
194
+
| `findByFirstnameNotNull()`
195
+
| `firstname IS NOT NULL`
196
+
197
+
| `IsNull`, `Null`
198
+
| `findByFirstnameNull()`
199
+
| `firstname IS NULL`
200
+
201
+
| `Like`, `StartingWith`, `EndingWith`
202
+
| `findByFirstnameLike(String name)`
203
+
| `firstname LIKE name`
204
+
205
+
| `NotLike`, `IsNotLike`
206
+
| `findByFirstnameNotLike(String name)`
207
+
| `firstname NOT LIKE name`
208
+
209
+
| `Containing` on String
210
+
| `findByFirstnameContaining(String name)`
211
+
| `firstname LIKE '%' + name +'%'`
212
+
213
+
| `NotContaining` on String
214
+
| `findByFirstnameNotContaining(String name)`
215
+
| `firstname NOT LIKE '%' + name +'%'`
216
+
217
+
| `(No keyword)`
218
+
| `findByFirstname(String name)`
219
+
| `firstname = name`
220
+
221
+
| `Not`
222
+
| `findByFirstnameNot(String name)`
223
+
| `firstname != name`
224
+
225
+
| `IsTrue`, `True`
226
+
| `findByActiveIsTrue()`
227
+
| `active IS TRUE`
123
228
124
-
NOTE: R2DBC repositories internally bind parameters to placeholders with `Statement.bind(…)` by index.
0 commit comments