code: private void handleBatch(
        Consumer<List<Entity>> consumer, EntityType entityType, Map<Object, Entity> batch) {
      AttributeType idAttributeDataType = entityType.getIdAttribute().getDataType();
      LOG.debug("Select ID values for a batch of MREF attributes...");
      for (Attribute mrefAttr : entityType.getAtomicAttributes()) {
        if (mrefAttr.getExpression() == null
            && isMultipleReferenceType(mrefAttr)
            && !(mrefAttr.getDataType() == ONE_TO_MANY && mrefAttr.isMappedBy())) {
          EntityType refEntityType = mrefAttr.getRefEntity();
          Multimap<Object, Object> mrefIDs =
              selectMrefIDsForAttribute(
                  entityType,
                  idAttributeDataType,
                  mrefAttr,
                  batch.keySet(),
                  refEntityType.getIdAttribute().getDataType());
          for (Map.Entry entry : batch.entrySet()) {
            batch
                .get(entry.getKey())
                .set(
                    mrefAttr.getName(),
                    postgreSqlEntityFactory.getReferences(
                        refEntityType, newArrayList(mrefIDs.get(entry.getKey()))));
          }
        }
      }
      LOG.trace("Feeding batch of {} rows to consumer.", batch.size());
      consumer.accept(batch.values().stream().collect(toList()));
    }
docs: Handles a batch of Entities. Looks up the values for MREF ID attributes and sets them as
  references in the entities. Then feeds the entities to the {@link Consumer}
  
  @param consumer {@link Consumer} to feed the batch to after setting the MREF ID values
  @param entityType EntityType for the {@link Entity}s in the batch
  @param batch {@link Map} mapping entity ID to entity for all {@link Entity}s in the batch