@RequiresSession
  public HostComponentStateEntity findByIndex(Long clusterId, String serviceName,
      String componentName, Long hostId) {
    final TypedQuery<HostComponentStateEntity> query = entityManagerProvider.get().createNamedQuery(
        "HostComponentStateEntity.findByIndex", HostComponentStateEntity.class);
    query.setParameter("clusterId", clusterId);
    query.setParameter("serviceName", serviceName);
    query.setParameter("componentName", componentName);
    query.setParameter("hostId", hostId);

    return daoUtils.selectSingle(query);
  }
Retrieve the single Host Component State for the given unique cluster,
service, component, and host.

@param clusterId
         Cluster ID
@param serviceName
         Service Name
@param componentName
         Component Name
@param hostId
         Host ID
@return Return all of the Host Component States that match the criteria.
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostComponentStateDAO.java