} while (DaoUtils.checkDuplicates(template, copy, queryName, namedCopy.getName(), null));
} while (DaoUtils.checkDuplicates(template, copy, queryName, namedCopy.getName()));
    public Object duplicateBean(BeanWithId bean, String queryName) {        BeanWithId copy = bean.duplicate();                if (bean instanceof NamedObject) {            // Give the new bean a unique name by prepending "copyOf" to the source            // bean's name until we get a name that hasn't been used yet.            HibernateTemplate template = getHibernateTemplate();            NamedObject namedCopy = (NamedObject) copy;            namedCopy.setName(((NamedObject) bean).getName());            do {                namedCopy.setName("CopyOf" + namedCopy.getName());            } while (DaoUtils.checkDuplicates(template, copy, queryName, namedCopy.getName(), null));        }                        return copy;    }