Top Description Fields Constructors Methods
org.springframework.jdbc.object

public Class GenericSqlQuery<T>

extends SqlQuery<T>
Class Inheritance
Type Parameters
<T>
the result type
Imports
java.util.Map, org.springframework.beans.BeanUtils, org.springframework.jdbc.core.RowMapper, org.springframework.lang.Nullable, org.springframework.util.Assert

A concrete variant of SqlQuery which can be configured with a RowMapper.
Authors
Thomas Risberg, Juergen Hoeller
Since
3.0
See Also
setRowMapper, setRowMapperClass

Field Summary

Modifier and TypeField and Description
private RowMapper<T>
private Class<? extends RowMapper<T>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
protected RowMapper<T>
newRowMapper(Object[]
the parameters to the execute() method, in case subclass is interested; may be null if there were no parameters.
parameters
,
Map<?, ?>
the contextual information passed to the mapRow callback method. The JDBC operation itself doesn't rely on this parameter, but it can be useful for creating the objects of the result list.
context
)

Implements abstract org.springframework.jdbc.object.SqlQuery.newRowMapper.

Subclasses must implement this method to extract an object per row, to be returned by the execute method as an aggregated List.

public void
setRowMapper(RowMapper<T> rowMapper)

Set a specific RowMapper instance to use for this query.

public void
setRowMapperClass(Class<? extends RowMapper<T>> rowMapperClass)

Set a RowMapper class for this query, creating a fresh RowMapper instance per execution.

Inherited from org.springframework.jdbc.object.SqlQuery:
executeexecuteexecuteexecuteexecuteexecuteexecuteexecuteexecuteexecuteexecuteexecuteexecuteByNamedParamexecuteByNamedParamfindObjectfindObjectfindObjectfindObjectfindObjectfindObjectfindObjectfindObjectfindObjectfindObjectfindObjectByNamedParamfindObjectByNamedParamgetRowsExpectedsetRowsExpected

Field Detail

rowMapperback to summary
private RowMapper<T> rowMapper
Annotations
@Nullable
rowMapperClassback to summary
private Class<? extends RowMapper<T>> rowMapperClass
Annotations
@SuppressWarnings:rawtypes
@Nullable

Constructor Detail

GenericSqlQueryback to summary
public GenericSqlQuery()

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Overrides org.springframework.jdbc.object.RdbmsOperation.afterPropertiesSet.

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.jdbc.object.RdbmsOperation.afterPropertiesSet.

Ensures compilation if used in a bean factory.

Annotations
@Override
newRowMapperback to summary
protected RowMapper<T> newRowMapper(Object[] parameters, Map<?, ?> context)

Implements abstract org.springframework.jdbc.object.SqlQuery.newRowMapper.

Doc from org.springframework.jdbc.object.SqlQuery.newRowMapper.

Subclasses must implement this method to extract an object per row, to be returned by the execute method as an aggregated List.

Parameters
parameters:Object[]

the parameters to the execute() method, in case subclass is interested; may be null if there were no parameters.

context:Map<?, ?>

the contextual information passed to the mapRow callback method. The JDBC operation itself doesn't rely on this parameter, but it can be useful for creating the objects of the result list.

Annotations
@Override
@SuppressWarnings:unchecked
setRowMapperback to summary
public void setRowMapper(RowMapper<T> rowMapper)

Set a specific RowMapper instance to use for this query.

Since
4.3.2
setRowMapperClassback to summary
public void setRowMapperClass(Class<? extends RowMapper<T>> rowMapperClass)

Set a RowMapper class for this query, creating a fresh RowMapper instance per execution.

Annotations
@SuppressWarnings:rawtypes