|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
com.alexkasko.springjdbc.iterable.IterableNamedParameterJdbcTemplate
public class IterableNamedParameterJdbcTemplate
NamedParameterJdbcTemplate
extension. All methods, that return List
mirrored with queryForIter
methods that return CloseableIterator
.
Constructor Summary | |
---|---|
IterableNamedParameterJdbcTemplate(DataSource dataSource)
Constructor |
|
IterableNamedParameterJdbcTemplate(DataSource dataSource,
int fetchSize)
Constructor, takes fetchSize |
Method Summary | ||
---|---|---|
IterableJdbcOperations |
getIterableJdbcOperations()
Expose IterableJdbcTemplate to allow queries without named parameters |
|
CloseableIterator<Map<String,Object>> |
queryForIter(String sql,
Map<String,?> paramMap)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. |
|
|
queryForIter(String sql,
Map<String,?> paramMap,
Class<T> elementType)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. |
|
|
queryForIter(String sql,
Map<String,?> paramMap,
org.springframework.jdbc.core.RowMapper<T> rowMapper)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a Java object via a RowMapper. |
|
CloseableIterator<Map<String,Object>> |
queryForIter(String sql,
org.springframework.jdbc.core.namedparam.SqlParameterSource paramSource)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. |
|
|
queryForIter(String sql,
org.springframework.jdbc.core.namedparam.SqlParameterSource paramSource,
Class<T> elementType)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. |
|
|
queryForIter(String sql,
org.springframework.jdbc.core.namedparam.SqlParameterSource paramSource,
org.springframework.jdbc.core.RowMapper<T> rowMapper)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a Java object via a RowMapper. |
Methods inherited from class org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate |
---|
batchUpdate, batchUpdate, execute, execute, getJdbcOperations, getParsedSql, getPreparedStatementCreator, query, query, query, query, query, query, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForMap, queryForMap, queryForObject, queryForObject, queryForObject, queryForObject, queryForRowSet, queryForRowSet, update, update, update, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IterableNamedParameterJdbcTemplate(DataSource dataSource)
dataSource
- data sourcepublic IterableNamedParameterJdbcTemplate(DataSource dataSource, int fetchSize)
fetchSize
dataSource
- data sourcefetchSize
- fetchSize property valueMethod Detail |
---|
public IterableJdbcOperations getIterableJdbcOperations()
getIterableJdbcOperations
in interface IterableNamedParameterJdbcOperations
public <T> CloseableIterator<T> queryForIter(String sql, org.springframework.jdbc.core.namedparam.SqlParameterSource paramSource, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
queryForIter
in interface IterableNamedParameterJdbcOperations
sql
- SQL query to executeparamSource
- container of arguments to bind to the queryrowMapper
- object that will map one object per row
org.springframework.dao.DataAccessException
- if the query failspublic <T> CloseableIterator<T> queryForIter(String sql, Map<String,?> paramMap, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
queryForIter
in interface IterableNamedParameterJdbcOperations
sql
- SQL query to executeparamMap
- map of parameters to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type)rowMapper
- object that will map one object per row
org.springframework.dao.DataAccessException
- if the query failspublic <T> CloseableIterator<T> queryForIter(String sql, org.springframework.jdbc.core.namedparam.SqlParameterSource paramSource, Class<T> elementType) throws org.springframework.dao.DataAccessException
The results will be mapped to a List (one entry for each row) of result objects, each of them matching the specified element type.
queryForIter
in interface IterableNamedParameterJdbcOperations
sql
- SQL query to executeparamSource
- container of arguments to bind to the queryelementType
- the required type of element in the result list
(for example, Integer.class
)
org.springframework.dao.DataAccessException
- if the query failsJdbcTemplate.queryForList(String, Class)
,
SingleColumnRowMapper
public <T> CloseableIterator<T> queryForIter(String sql, Map<String,?> paramMap, Class<T> elementType) throws org.springframework.dao.DataAccessException
The results will be mapped to a List (one entry for each row) of result objects, each of them matching the specified element type.
queryForIter
in interface IterableNamedParameterJdbcOperations
sql
- SQL query to executeparamMap
- map of parameters to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type)elementType
- the required type of element in the result list
(for example, Integer.class
)
org.springframework.dao.DataAccessException
- if the query failsJdbcTemplate.queryForList(String, Class)
,
SingleColumnRowMapper
public CloseableIterator<Map<String,Object>> queryForIter(String sql, org.springframework.jdbc.core.namedparam.SqlParameterSource paramSource) throws org.springframework.dao.DataAccessException
The results will be mapped to a List (one entry for each row) of Maps (one entry for each column, using the column name as the key). Thus Each element in the list will be of the form returned by this interface's queryForMap() methods.
queryForIter
in interface IterableNamedParameterJdbcOperations
sql
- SQL query to executeparamSource
- container of arguments to bind to the query
org.springframework.dao.DataAccessException
- if the query failsJdbcTemplate.queryForList(String)
public CloseableIterator<Map<String,Object>> queryForIter(String sql, Map<String,?> paramMap) throws org.springframework.dao.DataAccessException
The results will be mapped to a List (one entry for each row) of Maps (one entry for each column, using the column name as the key). Each element in the list will be of the form returned by this interface's queryForMap() methods.
queryForIter
in interface IterableNamedParameterJdbcOperations
sql
- SQL query to executeparamMap
- map of parameters to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type)
org.springframework.dao.DataAccessException
- if the query failsJdbcTemplate.queryForList(String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |