public void close() throws SQLException { if (!closed) { compiledStmt.close(); closed = true; last = null; if (statement != null) { logger.debug("closed iterator @{} after {} rows", hashCode(), rowC); } connectionSource.releaseConnection(connection); } }
/** If the statement parameter is null then this won't log information */ public SelectIterator( Class<?> dataClass, Dao<T, ID> classDao, GenericRowMapper<T> rowMapper, ConnectionSource connectionSource, DatabaseConnection connection, CompiledStatement compiledStmt, String statement, ObjectCache objectCache) throws SQLException { this.dataClass = dataClass; this.classDao = classDao; this.rowMapper = rowMapper; this.connectionSource = connectionSource; this.connection = connection; this.compiledStmt = compiledStmt; this.results = compiledStmt.runQuery(objectCache); this.statement = statement; if (statement != null) { logger.debug("starting iterator @{} for '{}'", hashCode(), statement); } }