public static void checkDuplicates(BeanWithId obj, Collection objs, UserException exception) {  if (objs.size() == 0) { return;
public static boolean checkDuplicates(HibernateTemplate hibernate, BeanWithId obj, String queryName, Object value, UserException exception) { if (value == null) { return false;
    public static void checkDuplicates(BeanWithId obj, Collection objs, UserException exception) {        // no match        if (objs.size() == 0) {            return;        }        // detect 1 match, itself        if (!obj.isNew() && objs.size() == 1) {            Integer found = (Integer) objs.iterator().next();            if (found.equals(obj.getId())) {                return;            }        }        throw exception;            }