コード例 #1
0
  @Override
  public List load(EntityInfo... entityInfos) {
    // no need to timeouManage here, the underlying loader is the real time consumer
    List results = new ArrayList(entityInfos.length);
    if (entityInfos.length == 0) {
      return results;
    }

    if (projectionEnabledOnThis(entityInfos[0])) {
      Loader objectLoader = getObjectLoader();
      objectLoader.load(entityInfos); // load by batch
      for (EntityInfo entityInfo : entityInfos) {
        final Object entityInstance = objectLoader.loadWithoutTiming(entityInfo);
        entityInfo.populateWithEntityInstance(entityInstance);
      }
    }
    for (EntityInfo entityInfo : entityInfos) {
      if (transformer != null) {
        results.add(transformer.transformTuple(entityInfo.getProjection(), aliases));
      } else {
        results.add(entityInfo.getProjection());
      }
    }

    return results;
  }
コード例 #2
0
 @Override
 public Object load(EntityInfo entityInfo) {
   // no need to timeouManage here, the underlying loader is the real time consumer
   if (projectionEnabledOnThis(entityInfo)) {
     Loader objectLoader = getObjectLoader();
     final Object entityInstance = objectLoader.load(entityInfo);
     entityInfo.populateWithEntityInstance(entityInstance);
   }
   if (transformer != null) {
     return transformer.transformTuple(entityInfo.getProjection(), aliases);
   } else {
     return entityInfo.getProjection();
   }
 }
コード例 #3
0
  @Override
  protected List getResultList(List results, ResultTransformer resultTransformer)
      throws QueryException {
    // meant to handle dynamic instantiation queries...(Copy from QueryLoader)
    HolderInstantiator holderInstantiator =
        HolderInstantiator.getHolderInstantiator(
            null, resultTransformer, getReturnAliasesForTransformer());
    if (holderInstantiator.isRequired()) {
      for (int i = 0; i < results.size(); i++) {
        Object[] row = (Object[]) results.get(i);
        Object result = holderInstantiator.instantiate(row);
        results.set(i, result);
      }

      return resultTransformer.transformList(results);
    } else {
      return results;
    }
  }