@RequiresSession
  public ResourceTypeEntity findByName(String name) {
    TypedQuery<ResourceTypeEntity> query = entityManagerProvider.get().createQuery(
        "SELECT resourceType FROM ResourceTypeEntity resourceType WHERE resourceType.name = ?1",
        ResourceTypeEntity.class);
    return daoUtils.selectSingle(query, name);
  }
Find a resource type with the given name.

@param name  type name

@return  a matching resource type or null
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/ResourceTypeDAO.java