@RequiresSession
  public List<ClusterConfigEntity> getLatestConfigurations(long clusterId,
      StackId stackId) {
    StackEntity stackEntity = stackDAO.find(stackId.getStackName(),
        stackId.getStackVersion());

    TypedQuery<ClusterConfigEntity> query = entityManagerProvider.get().createNamedQuery(
        "ClusterConfigEntity.findLatestConfigsByStack",
        ClusterConfigEntity.class);

    query.setParameter("clusterId", clusterId);
    query.setParameter("stack", stackEntity);

    return daoUtils.selectList(query);
  }
Gets the latest configurations for a given stack for all of the
configurations of the specified cluster. This method does not take into
account the configuration being enabled, as the latest for a given stack
may not be "selected".

@param clusterId
         the cluster that the service is a part of.
@param stackId
         the stack to get the latest configurations for (not {@code null}).
@return the latest configurations for the specified cluster and stack.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java