try
{
if (inMemory)
{
// IN-MEMORY EVALUATION
ResultObjectFactory rof = storeMgr.newResultObjectFactory(acmd,
datastoreCompilation.getResultDefinitionForClass(),
RDBMSQueryUtils.useUpdateLockForQuery(this), getFetchPlan(),
candidateClass);
// Just instantiate the candidates for later in-memory processing
// TODO Use a queryResult rather than an ArrayList so we load when required
List candidates = new ArrayList();
while (rs.next())
{
candidates.add(rof.getObject(ec, rs));
}
// Perform in-memory filter/result/order etc
JavaQueryEvaluator resultMapper =
new JDOQLEvaluator(this, candidates, compilation, parameters, clr);
results = resultMapper.execute(true, true, true, true, true);
}
else
{
// IN-DATASTORE EVALUATION
ResultObjectFactory rof = null;
if (result != null)
{
// Each result row is of a result type
rof = new ResultClassROF(resultClass, datastoreCompilation.getResultDefinition());
}