@RequiresSession
  public ServiceComponentDesiredStateEntity findByName(long clusterId, String serviceName,
      String componentName) {
    EntityManager entityManager = entityManagerProvider.get();
    TypedQuery<ServiceComponentDesiredStateEntity> query = entityManager.createNamedQuery(
        "ServiceComponentDesiredStateEntity.findByName", ServiceComponentDesiredStateEntity.class);

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

    ServiceComponentDesiredStateEntity entity = null;
    List<ServiceComponentDesiredStateEntity> entities = daoUtils.selectList(query);
    if (null != entities && !entities.isEmpty()) {
      entity = entities.get(0);
    }

    return entity;
  }
Finds a {@link ServiceComponentDesiredStateEntity} by a combination of
cluster, service, and component.

@param clusterId
         the cluster ID
@param serviceName
         the service name (not {@code null})
@param componentName
         the component name (not {@code null})
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ServiceComponentDesiredStateDAO.java