@RequiresSession
  public Long getLastStageId(long requestId) {
    TypedQuery<Long> query = entityManagerProvider.get().createQuery("SELECT max(stage.stageId) " +
      "FROM StageEntity stage WHERE stage.requestId=?1", Long.class);
    return daoUtils.selectSingle(query, requestId);
  }
Given a collection of request ids, load the corresponding entities
@param requestIds  the collection of request ids
@param refreshHint {@code true} to hint JPA that the list should be refreshed
@return the list entities. An empty list if the requestIds are not provided
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/RequestDAO.java