Connection connection = connectionProvider.getConnection();
return new ConnectionResourceManagingIterator<T>(
new FilteredBatchingIterator<T>(whereClause, parameters, batchSize, sqlSchema, connection),
connection);
} catch (SQLException e) {
throw new EventStoreException("Exception while attempting to read from the Event Store database", e);
}
// we don't want to close the connection here. The ConnectionResourceManagingIterator will close the connection
// when it finishes iterating the results.
}