Annotation Interface Query
Annotation to provide SQL statements that will get used for executing the method. The SQL statement may contain named
parameters as supported by
NamedParameterJdbcTemplate
. Those
parameters will get bound to the arguments of the annotated method.
You can also specify the way to extract data from ResultSet
. There are 4 attribute of this
annotation you can set to do that:
The annotation attributes above are listed in their preference order, that is - the
resultSetExtractorRef()
,
has the highest privilege and, will suppress any other 3 attribute from above, and consequently rowMapperClass()
has the lowest privilege and will be used if any of three above are not specified.- Author:
- Jens Schauder, Moises Cisneros, Hebert Coelho, Mikhail Polivakha
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionThe named query to be used.Class<? extends ResultSetExtractor>
OptionalResultSetExtractor
to use to convert the result of the query to domain class instances.Optional name of a bean of typeResultSetExtractor
to use to convert the result of the query to domain class instances.OptionalRowMapper
to use to convert the result of the query to domain class instances.Optional name of a bean of typeRowMapper
to use to convert the result of the query to domain class instances.The SQL statement to execute when the annotated method gets invoked.
-
Element Details
-
value
String valueThe SQL statement to execute when the annotated method gets invoked.- Default:
- ""
-
name
String nameThe named query to be used. If not defined, the name of${domainClass}.${queryMethodName}
will be used.- Default:
- ""
-
rowMapperClass
OptionalRowMapper
to use to convert the result of the query to domain class instances.- Default:
- org.springframework.jdbc.core.RowMapper.class
-
rowMapperRef
String rowMapperRefOptional name of a bean of typeRowMapper
to use to convert the result of the query to domain class instances.- Since:
- 2.1
- Default:
- ""
-
resultSetExtractorClass
Class<? extends ResultSetExtractor> resultSetExtractorClassOptionalResultSetExtractor
to use to convert the result of the query to domain class instances.- Default:
- org.springframework.jdbc.core.ResultSetExtractor.class
-
resultSetExtractorRef
String resultSetExtractorRefOptional name of a bean of typeResultSetExtractor
to use to convert the result of the query to domain class instances.- Since:
- 2.1
- Default:
- ""
-