@RequiresSession
  public HostVersionEntity findByClusterStackVersionAndHost(String clusterName,
      StackId stackId, String version, String hostName) {

    final TypedQuery<HostVersionEntity> query = entityManagerProvider.get()
        .createNamedQuery("hostVersionByClusterStackVersionAndHostname", HostVersionEntity.class);
    query.setParameter("clusterName", clusterName);
    query.setParameter("stackName", stackId.getStackName());
    query.setParameter("stackVersion", stackId.getStackVersion());
    query.setParameter("version", version);
    query.setParameter("hostName", hostName);

    return daoUtils.selectSingle(query);
  }
Retrieve the single host version for the given cluster, stack name, stack
version, and host name. <br/>
This query is slow and not suitable for frequent use.

@param clusterName
         Cluster name
@param stackId
         Stack ID (e.g., HDP-2.2)
@param version
         Stack version (e.g., 2.2.0.1-995)
@param hostName
         FQDN of host
@return Returns the single host version that matches the criteria.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostVersionDAO.java