@RequiresSession
  public ViewInstanceEntity findByName(String viewName, String instanceName) {
    TypedQuery<ViewInstanceEntity> query = entityManagerProvider.get().createQuery(
      "SELECT instance FROM ViewInstanceEntity instance WHERE instance.viewName = ?1 AND instance.name = ?2",
      ViewInstanceEntity.class);
    return daoUtils.selectSingle(query, viewName, instanceName);
  }
Find a view with the given names.

@param viewName      name of view
@param instanceName  name of the instance

@return  a matching view instance or null
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ViewInstanceDAO.java