code: @Override
      protected List<Object> populateEntities(EntityMetadata m, Client client)
      {
          ApplicationMetadata appMetadata = kunderaMetadata.getApplicationMetadata();
  
          try
          {
              String query = appMetadata.getQuery(getJPAQuery());
  
              boolean isNative = kunderaQuery.isNative();
  
              if (isNative)
              { // Native Query Support is enabled
                  return ((MongoDBClient) client).executeQuery(query == null ? getJPAQuery() : query, m);
              }
  
              if (MetadataUtils.useSecondryIndex(((ClientBase) client).getClientMetadata()))
              {
                  if (kunderaQuery.isAggregated())
                  {
                      return ((MongoDBClient) client).aggregate(m,
                              createMongoQuery(m, getKunderaQuery().getFilterClauseQueue()), createAggregationLookup(m),
                              createAggregation(m), getAggregationOrderByClause(m), isSingleResult ? 1 : maxResult);
                  }
                  else
                  {
                      BasicDBObject orderByClause = getOrderByClause(m);
                      return ((MongoDBClient) client).loadData(m,
                              createMongoQuery(m, getKunderaQuery().getFilterClauseQueue()), null, orderByClause,
                              isSingleResult ? 1 : maxResult, firstResult, isCountQuery(),
                              getKeys(m, getKunderaQuery().getResult()), getKunderaQuery().getResult());
                  }
              }
              else
              {
                  return populateUsingLucene(m, client, null, getKunderaQuery().getResult());
              }
  
          }
          catch (Exception e)
          {
  
              log.error("Error during executing query, Caused by:", e);
              throw new QueryHandlerException(e);
          }
      }
docs: /*
  (non-Javadoc)
  
  @see
  com.impetus.kundera.query.QueryImpl#populateEntities(com.impetus.kundera
  .metadata.model.EntityMetadata, com.impetus.kundera.client.Client)