//this can be null, because either one exists in the query or it will be created
Hashtable referenceObjectsByKey = null;
synchronized (query) {
referenceObjectsByKey = getBatchReadObjects(query, session);
if (referenceObjectsByKey == null) {
ReadAllQuery batchQuery = (ReadAllQuery)query;
ComplexQueryResult complexResult = (ComplexQueryResult)session.executeQuery(batchQuery, argumentRow);
// Batch query created in ForeignReferenceMapping.prepareNestedBatchQuery without specifying container policy - uses ListContainerPolicy by default.
List results = (List)complexResult.getResult();
referenceObjectsByKey = new Hashtable();
List rows = (List)complexResult.getData();