@RequiresSession
  public List<ServiceConfigEntity> getLastServiceConfigsForService(Long clusterId, String serviceName) {
    TypedQuery<ServiceConfigEntity> query = entityManagerProvider.get().createNamedQuery(
        "ServiceConfigEntity.findLatestServiceConfigsByService",
        ServiceConfigEntity.class);

    query.setParameter("clusterId", clusterId);
    query.setParameter("serviceName", serviceName);

    return daoUtils.selectList(query);
  }
Gets the latest service config versions of all config groups for a service
@param clusterId
         the cluster (not {@code null}).
@param serviceName
         Name of the service whose latest service config versions needs to be retrieved .
@return all service configurations for the cluster and service.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceConfigDAO.java