code: protected <Y> T getUniqueByAttribute(SingularAttribute<T, Y> attribute,
              Y value) {
          try {
              return getDatabaseSupport().getUniqueByAttribute(getEntityClass(), attribute, value);
          } catch (NoResultException ex) {
              return null;
          }
      }
docs: Gets the entity that has the target value of the specified attribute.
  
  @param <Y> the type of the attribute and target value.
  @param attribute the attribute of the entity to compare.
  @param value the target value of the given attribute.
  
  @return the matching entity, or <code>null</code> if there is none.