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
Copy file name to clipboardExpand all lines: src/main/antora/modules/ROOT/pages/jdbc/query-methods.adoc
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -169,6 +169,8 @@ Properties that don't have a matching column in the result will not be set.
169
169
The query is used for populating the aggregate root, embedded entities and one-to-one relationships including arrays of primitive types which get stored and loaded as SQL-array-types.
170
170
Separate queries are generated for maps, lists, sets and arrays of entities.
171
171
172
+
173
+
172
174
NOTE: Spring fully supports Java 8’s parameter name discovery based on the `-parameters` compiler flag.
173
175
By using this flag in your build as an alternative to debug information, you can omit the `@Param` annotation for named parameters.
174
176
@@ -198,9 +200,14 @@ The recommended way to do that is a `try-with-resource clause`.
198
200
It also means that, once the connection to the database is closed, the stream cannot obtain further elements and likely throws an exception.
199
201
200
202
[[jdbc.query-methods.at-query.custom-rowmapper]]
201
-
=== Custom `RowMapper`
203
+
=== Custom `RowMapper` or `ResultSetExtractor`
204
+
205
+
The `@Query` annotation allows you to specify a custom `RowMapper` or `ResultSetExtractor` to use.
206
+
The attributes `rowMapperClass` and `resultSetExtractorClass` allow you to specify classes to use, which will get instantiated using a default constructor.
207
+
Alternatively you may set `rowMapperClassRef` or `resultSetExtractorClassRef` to a bean name from your Spring application context.
202
208
203
-
You can configure which `RowMapper` to use, either by using the `@Query(rowMapperClass = ....)` or by registering a `RowMapperMap` bean and registering a `RowMapper` per method return type.
209
+
If you want to use a certain `RowMapper` not just for a single method but for all methods with custom queries returning a certain type,
210
+
you may register a `RowMapperMap` bean and registering a `RowMapper` per method return type.
204
211
The following example shows how to register `DefaultQueryMappingConfiguration`:
0 commit comments