@RequiresSession
  public PrincipalTypeEntity findByName(String name) {
    TypedQuery<PrincipalTypeEntity> query = entityManagerProvider.get().createNamedQuery("PrincipalTypeEntity.findByName", PrincipalTypeEntity.class);
    query.setParameter("name", name);
    return daoUtils.selectSingle(query);
  }
Find a principal type entity with the given name.

@param name  principal type name

@return  a matching principal type entity or null
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/PrincipalTypeDAO.java