Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
Spring-JDBC extension library. Provides IterableJdbcTemplate and IterableNamedParameterJdbcTemplate
that can return query result in lazy mode as iterators
package com.alexkasko.springjdbc.iterable;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.PreparedStatementSetter;
import org.springframework.jdbc.core.RowMapper;
import java.util.Map;
/**
* Extension interface for {@code JdbcOperations}. All methods, that return {@code List}
* mirrored with {@code queryForIter} methods that return {@link CloseableIterator}.
* Javadocs borrowed from {@code JdbcOperations}.
*
* @author alexkasko
* Date: 11/7/12
* @see IterableNamedParameterJdbcOperations
*/
public interface IterableJdbcOperations {
/**
* Query using a prepared statement, mapping each row to a Java object
* via a RowMapper.
*
A PreparedStatementCreator can either be implemented directly or
* configured through a PreparedStatementCreatorFactory.
*
* @param psc object that can create a PreparedStatement given a Connection
* If this is null, the SQL will be assumed to contain no bind parameters.
* @param rowMapper object that will map one object per row
* @return the result Iterator, containing mapped objects
* @throws DataAccessException if there is any problem
* @see org.springframework.jdbc.core.PreparedStatementCreatorFactory
*/
CloseableIterator queryForIter(PreparedStatementCreator psc, RowMapper rowMapper) throws DataAccessException;
/**
* Query using a prepared statement, mapping each row to a Java object
* via a RowMapper.
*
A PreparedStatementCreator can either be implemented directly or
* configured through a PreparedStatementCreatorFactory.
*
* @param psc object that can create a PreparedStatement given a Connection
* @param pss 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.
* @param rowMapper object that will map one object per row
* @return the result Iterator, containing mapped objects
* @throws DataAccessException if there is any problem
* @see org.springframework.jdbc.core.PreparedStatementCreatorFactory
*/
CloseableIterator queryForIter(PreparedStatementCreator psc, PreparedStatementSetter pss, RowMapper rowMapper)
throws DataAccessException;
/**
* Execute a query given static SQL, mapping each row to a Java object
* via a RowMapper.
*
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.
*
* @param sql SQL query to execute
* @param rowMapper object that will map one object per row
* @return the result Iterator, containing mapped objects
* @throws DataAccessException if there is any problem executing the query
* @see #queryForIter(String, Object[], RowMapper)
*/
CloseableIterator queryForIter(String sql, RowMapper rowMapper) throws DataAccessException;
/**
* Execute a query for a result шterator, given static SQL.
*
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.
*
* @param sql SQL query to execute
* @param elementType the required type of element in the result шterator
* (for example, Integer.class)
* @return an Iterator of objects that match the specified element type
* @throws DataAccessException if there is any problem executing the query
* @see #queryForIter(String, Object[], Class)
* @see org.springframework.jdbc.core.SingleColumnRowMapper
*/
CloseableIterator queryForIter(String sql, Class elementType) throws DataAccessException;
/**
* Execute a query for a result iterator, given static SQL.
*
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.
*
* @param sql SQL query to execute
* @return an Iterator that contains a Map per row
* @throws DataAccessException if there is any problem executing the query
* @see #queryForIter(String, Object[])
*/
CloseableIterator