log.info("Of primaryKey count: " + primaryKeys.count() + " fetching range: " + range + " which is: " + primaryKeysToFetch.count());
log.debug("Of primaryKey count: " + primaryKeys.count() + " fetching range: " + range + " which is: " + primaryKeysToFetch.count());
    public NSArray nextBatch() {        if (editingContext() == null)            throw new RuntimeException("ERXFetchSpecificationBatchIterator: Calling nextBatch with a null editing context!");                EOEntity entity = EOUtilities.entityNamed(editingContext(), fetchSpecification.entityName());        if (entity.primaryKeyAttributes().count() > 1)            throw new RuntimeException("ERXFetchSpecificationBatchIterator: Currently only single primary key entities are supported.");        String primaryKeyAttributeName = ((EOAttribute)entity.primaryKeyAttributes().lastObject()).name();        NSArray nextBatch = null;        if (!hasFetchedPrimaryKeys())            fetchPrimaryKeys();        if (hasNextBatch()) {            int length = primaryKeys.count() - currentObjectFetchCount > batchSize() ? batchSize() : primaryKeys.count() - currentObjectFetchCount;            NSRange range = new NSRange(currentObjectFetchCount, length);            NSArray primaryKeysToFetch = primaryKeys.subarrayWithRange(range);            log.info("Of primaryKey count: " + primaryKeys.count() + " fetching range: " + range + " which is: " + primaryKeysToFetch.count());            ERXInQualifier qual = new ERXInQualifier(primaryKeyAttributeName, primaryKeysToFetch);            //EOFetchSpecification fetchSpec = (EOFetchSpecification)fetchSpecification.clone();            //fetchSpec.setQualifier(qual);            EOFetchSpecification fetchSpec = new EOFetchSpecification(fetchSpecification.entityName(), qual, fetchSpecification.sortOrderings());            if (fetchSpecification.prefetchingRelationshipKeyPaths() != null)                fetchSpec.setPrefetchingRelationshipKeyPaths(fetchSpecification.prefetchingRelationshipKeyPaths());            nextBatch = editingContext().objectsWithFetchSpecification(fetchSpec);            currentObjectFetchCount += length;            currentBatchIndex++;        }        return nextBatch != null ? nextBatch : NSArray.EmptyArray;    }