@Override public T next() { if ( !hasNext() ) { throw new NoSuchElementException(); } currentRowRead = true; T element; try { element = createElement( rs ); } catch ( SQLException e ) { // try to close everything close(); // wrap as unchecked exception throw new RuntimeException( e.getMessage(), e ); } return element; }
@Override public boolean hasNext() { if ( !currentRowRead ) { return true; } try { if ( rs.next() ) { currentRowRead = false; return true; } } catch ( SQLException e ) { // try to close everything close(); // wrap as unchecked exception throw new RuntimeException( e.getMessage(), e ); } return false; }
@Override public void remove() { try { rs.deleteRow(); } catch ( SQLException e ) { // try to close everything close(); // wrap as unchecked exception throw new RuntimeException( e.getMessage(), e ); } }