// Lazy loading results : add listener to the connection so we can get a callback when the connection is flushed.
final AbstractQueryResult qr = (AbstractQueryResult)results;
ManagedConnectionResourceListener listener = new ManagedConnectionResourceListener() {
public void managedConnectionPreClose() {
// Disconnect the query from this ManagedConnection (read in unread rows etc)
qr.disconnect();
}
public void managedConnectionPostClose() {}
public void resourcePostClose() {
mconn.removeListener(this);
}