resultInMemory, resultClass != null, false);
}
if (results instanceof AbstractQueryResult) {
// Lazy loading results : add listener to the connection so we can get a callback when the connection is flushed.
final AbstractQueryResult qr = (AbstractQueryResult)results;
final ManagedConnection mconn = getStoreManager().getConnection(ec);
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);
}
public void transactionFlushed() {}
public void transactionPreClose() {
// Disconnect the query from this ManagedConnection (read in unread rows etc)
qr.disconnect();
}
};
mconn.addListener(listener);
qr.addConnectionListener(listener);
}
}
if (NucleusLogger.QUERY.isDebugEnabled()) {
NucleusLogger.QUERY.debug(LOCALISER.msg("021074", "JDOQL", "" + (System.currentTimeMillis() - startTime)));