|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.jdbc.support.JdbcAccessor
org.springframework.jdbc.core.JdbcTemplate
com.alexkasko.springjdbc.iterable.IterableJdbcTemplate
public class IterableJdbcTemplate
JdbcTemplate
extension. All methods, that return List
mirrored with queryForIter
methods that return CloseableIterator
.
Constructor Summary | |
---|---|
IterableJdbcTemplate(DataSource dataSource)
Constructor |
|
IterableJdbcTemplate(DataSource dataSource,
int fetchSize)
Constructor, takes fetchSize |
Method Summary | ||
---|---|---|
static void |
closeQuetly(CloseableIterator<?> iter)
Deprecated. |
|
|
queryForIter(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.RowMapper<T> rowMapper)
Query using a prepared statement, mapping each row to a Java object via a RowMapper. |
|
|
queryForIter(org.springframework.jdbc.core.PreparedStatementCreator psc,
org.springframework.jdbc.core.RowMapper<T> rowMapper)
Query using a prepared statement, mapping each row to a Java object via a RowMapper. |
|
CloseableIterator<Map<String,Object>> |
queryForIter(String sql)
Execute a query for a result iterator, given static SQL. |
|
|
queryForIter(String sql,
Class<T> elementType)
Execute a query for a result шterator, given static SQL. |
|
|
queryForIter(String sql,
Class<T> elementType,
Object... args)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result iterator. |
|
CloseableIterator<Map<String,Object>> |
queryForIter(String sql,
Object... args)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result iterator. |
|
|
queryForIter(String sql,
Object[] args,
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 iterator. |
|
CloseableIterator<Map<String,Object>> |
queryForIter(String sql,
Object[] args,
int[] argTypes)
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result iterator. |
|
|
queryForIter(String sql,
Object[] args,
int[] argTypes,
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 iterator. |
|
|
queryForIter(String sql,
Object[] args,
int[] argTypes,
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. |
|
|
queryForIter(String sql,
Object[] args,
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. |
|
|
queryForIter(String sql,
org.springframework.jdbc.core.PreparedStatementSetter pss,
org.springframework.jdbc.core.RowMapper<T> rowMapper)
Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, mapping each row to a Java object via a RowMapper. |
|
|
queryForIter(String sql,
org.springframework.jdbc.core.RowMapper<T> rowMapper)
Execute a query given static SQL, mapping each row to a Java object via a RowMapper. |
|
|
queryForIter(String sql,
org.springframework.jdbc.core.RowMapper<T> rowMapper,
Object... args)
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.JdbcTemplate |
---|
applyStatementSettings, batchUpdate, batchUpdate, call, createConnectionProxy, createResultsMap, execute, execute, execute, execute, execute, execute, execute, extractOutputParameters, extractReturnedResults, getColumnMapRowMapper, getFetchSize, getMaxRows, getNativeJdbcExtractor, getQueryTimeout, getSingleColumnRowMapper, handleWarnings, handleWarnings, isIgnoreWarnings, isResultsMapCaseInsensitive, isSkipResultsProcessing, isSkipUndeclaredResults, newArgPreparedStatementSetter, newArgTypePreparedStatementSetter, processResultSet, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, query, queryForInt, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForList, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForLong, queryForMap, queryForMap, queryForMap, queryForObject, queryForObject, queryForObject, queryForObject, queryForObject, queryForObject, queryForObject, queryForObject, queryForRowSet, queryForRowSet, queryForRowSet, setFetchSize, setIgnoreWarnings, setMaxRows, setNativeJdbcExtractor, setQueryTimeout, setResultsMapCaseInsensitive, setSkipResultsProcessing, setSkipUndeclaredResults, update, update, update, update, update, update, update |
Methods inherited from class org.springframework.jdbc.support.JdbcAccessor |
---|
afterPropertiesSet, getDataSource, getExceptionTranslator, isLazyInit, setDatabaseProductName, setDataSource, setExceptionTranslator, setLazyInit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IterableJdbcTemplate(DataSource dataSource)
dataSource
- data sourcepublic IterableJdbcTemplate(DataSource dataSource, int fetchSize)
fetchSize
dataSource
- data sourcefetchSize
- fetchSize property valueMethod Detail |
---|
@Deprecated public static void closeQuetly(CloseableIterator<?> iter)
CloseableIterator
s. Writes warning into log on exception.
Since 1.2 IOUtils.closeQuietly()
may be used instead this one.
iter
- iterator to closepublic <T> CloseableIterator<T> queryForIter(org.springframework.jdbc.core.PreparedStatementCreator psc, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.
queryForIter
in interface IterableJdbcOperations
psc
- object that can create a PreparedStatement given a Connection
If this is null, the SQL will be assumed to contain no bind parameters.rowMapper
- object that will map one object per row
org.springframework.dao.DataAccessException
- if there is any problemPreparedStatementCreatorFactory
public <T> CloseableIterator<T> queryForIter(org.springframework.jdbc.core.PreparedStatementCreator psc, org.springframework.jdbc.core.PreparedStatementSetter pss, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
A PreparedStatementCreator can either be implemented directly or configured through a PreparedStatementCreatorFactory.
queryForIter
in interface IterableJdbcOperations
psc
- object that can create a PreparedStatement given a Connectionpss
- object that knows how to set values on the prepared statement.
If this is null, the SQL will be assumed to contain no bind parameters.rowMapper
- object that will map one object per row
org.springframework.dao.DataAccessException
- if there is any problemPreparedStatementCreatorFactory
public <T> CloseableIterator<T> queryForIter(String sql, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
Uses a JDBC Statement, not a PreparedStatement. If you want to
execute a static query with a PreparedStatement, use the overloaded
queryForIter
method with null
as argument array.
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executerowMapper
- object that will map one object per row
org.springframework.dao.DataAccessException
- if there is any problem executing the queryIterableJdbcOperations.queryForIter(String, Object[], RowMapper)
public <T> CloseableIterator<T> queryForIter(String sql, Class<T> elementType) throws org.springframework.dao.DataAccessException
Uses a JDBC Statement, not a PreparedStatement. If you want to
execute a static query with a PreparedStatement, use the overloaded
queryForIter
method with null
as argument array.
The results will be mapped to a Iterator (one entry for each row) of result objects, each of them matching the specified element type.
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executeelementType
- the required type of element in the result шterator
(for example, Integer.class
)
org.springframework.dao.DataAccessException
- if there is any problem executing the queryIterableJdbcOperations.queryForIter(String, Object[], Class)
,
SingleColumnRowMapper
public CloseableIterator<Map<String,Object>> queryForIter(String sql) throws org.springframework.dao.DataAccessException
Uses a JDBC Statement, not a PreparedStatement. If you want to
execute a static query with a PreparedStatement, use the overloaded
queryForIter
method with null
as argument array.
The results will be mapped to a Iterator (one entry for each row) of Maps (one entry for each column using the column name as the key). Each element in the iterator will be of the form returned by this interface's queryForMap() methods.
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to execute
org.springframework.dao.DataAccessException
- if there is any problem executing the queryIterableJdbcOperations.queryForIter(String, Object[])
public <T> CloseableIterator<T> queryForIter(String sql, org.springframework.jdbc.core.PreparedStatementSetter pss, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executepss
- object that knows how to set values on the prepared statement.
If this is null
, the SQL will be assumed to contain no bind parameters.
Even if there are no bind parameters, this object may be used to
set fetch size and other performance options.rowMapper
- object that will map one object per row
org.springframework.dao.DataAccessException
- if the query failspublic <T> CloseableIterator<T> queryForIter(String sql, Object[] args, int[] argTypes, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executeargs
- arguments to bind to the queryargTypes
- SQL types of the arguments
(constants from java.sql.Types
)rowMapper
- object that will map one object per row
org.springframework.dao.DataAccessException
- if the query failsTypes
public <T> CloseableIterator<T> queryForIter(String sql, Object[] args, org.springframework.jdbc.core.RowMapper<T> rowMapper) throws org.springframework.dao.DataAccessException
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executeargs
- arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain SqlParameterValue
objects which indicate not
only the argument value but also the SQL type and optionally the scalerowMapper
- 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.RowMapper<T> rowMapper, Object... args) throws org.springframework.dao.DataAccessException
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executerowMapper
- object that will map one object per rowargs
- arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain SqlParameterValue
objects which indicate not
only the argument value but also the SQL type and optionally the scale
org.springframework.dao.DataAccessException
- if the query failspublic <T> CloseableIterator<T> queryForIter(String sql, Object[] args, int[] argTypes, Class<T> elementType) throws org.springframework.dao.DataAccessException
The results will be mapped to a Iterator (one entry for each row) of result objects, each of them matching the specified element type.
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executeargs
- arguments to bind to the queryargTypes
- SQL types of the arguments
(constants from java.sql.Types
)elementType
- the required type of element in the result iterator
(for example, Integer.class
)
org.springframework.dao.DataAccessException
- if the query failsIterableJdbcOperations.queryForIter(String, Class)
,
SingleColumnRowMapper
public <T> CloseableIterator<T> queryForIter(String sql, Object[] args, Class<T> elementType) throws org.springframework.dao.DataAccessException
The results will be mapped to an Iterator (one entry for each row) of result objects, each of them matching the specified element type.
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executeargs
- arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain SqlParameterValue
objects which indicate not
only the argument value but also the SQL type and optionally the scaleelementType
- the required type of element in the result iterator
(for example, Integer.class
)
org.springframework.dao.DataAccessException
- if the query failsIterableJdbcOperations.queryForIter(String, Class)
,
SingleColumnRowMapper
public <T> CloseableIterator<T> queryForIter(String sql, Class<T> elementType, Object... args) throws org.springframework.dao.DataAccessException
The results will be mapped to an Iterator (one entry for each row) of result objects, each of them matching the specified element type.
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executeelementType
- the required type of element in the result iterator
(for example, Integer.class
)args
- arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain SqlParameterValue
objects which indicate not
only the argument value but also the SQL type and optionally the scale
org.springframework.dao.DataAccessException
- if the query failsIterableJdbcOperations.queryForIter(String, Class)
,
SingleColumnRowMapper
public CloseableIterator<Map<String,Object>> queryForIter(String sql, Object[] args, int[] argTypes) throws org.springframework.dao.DataAccessException
The results will be mapped to an Iterator (one entry for each row) of
Maps (one entry for each column, using the column name as the key).
Thus Each element in the iterator will be of the form returned by JdbcOperations
'
queryForMap() methods.
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executeargs
- arguments to bind to the queryargTypes
- SQL types of the arguments
(constants from java.sql.Types
)
org.springframework.dao.DataAccessException
- if the query failsIterableJdbcOperations.queryForIter(String)
,
Types
public CloseableIterator<Map<String,Object>> queryForIter(String sql, Object... args) throws org.springframework.dao.DataAccessException
The results will be mapped to an Iterator (one entry for each row) of Maps (one entry for each column, using the column name as the key). Each element in the iterator will be of the form returned by this interface's queryForMap() methods.
queryForIter
in interface IterableJdbcOperations
sql
- SQL query to executeargs
- arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain SqlParameterValue
objects which indicate not
only the argument value but also the SQL type and optionally the scale
org.springframework.dao.DataAccessException
- if the query failsIterableJdbcOperations.queryForIter(String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |