...switched to (so there is no need to flush in the loop each time):
public class ScrollableResultSetWrapper implements Enumeration {
private ScrollableResults results;
private Object current;
private boolean closed = true;
private boolean more = false;
public ScrollableResultSetWrapper(ScrollableResults results) {
this.results = results;
this.closed = false;
}
public boolean hasMoreElements() {
more = results.next();
if (!more) {
close();
return false;
}
current = results.get();
return more;
}
public Object nextElement() {
if (!more) {
throw new NoSuchElementException("No more entries");
}
return current;
}
public void close() {
if (!closed) {
results.close();
}
closed = true;
}
}
this works with the code in
http://www.hibernate.org/hib_docs/v3/re ... tch-update
thanks