@RequiresSession
  public List<ClusterConfigEntity> getAllConfigurations(Long clusterId,
      StackId stackId) {

    StackEntity stackEntity = stackDAO.find(stackId.getStackName(),
        stackId.getStackVersion());

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

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

    return daoUtils.selectList(query);
  }
Get all configurations for the specified cluster and stack. This will
return different versions of the same configuration type (cluster-env v1
and cluster-env v2) if they exist.

@param clusterId
         the cluster (not {@code null}).
@param stackId
         the stack (not {@code null}).
@return all service configurations for the cluster and stack.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ClusterDAO.java