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

@param name  permission name

@return  a matching permission entity or null
ambari-server/src/main/java/org/apache/ambari/server/orm/dao/PermissionDAO.java