if (DaoUtils.checkDuplicates(hibernate, user, QUERY_USER_IDS_BY_NAME_OR_ALIAS, alias)) {
if (DaoUtils.checkDuplicatesByNamedQuery(hibernate, user, QUERY_USER_IDS_BY_NAME_OR_ALIAS, alias, null)) {
    public String checkForDuplicateNameOrAlias(User user) {        HibernateTemplate hibernate = getHibernateTemplate();        String result = null;                // Check for duplication within the user itself        List names = new ArrayList(user.getAliases());        names.add(user.getUserName());        result = checkForDuplicateString(names);        if (result == null) {            // Check the username.  If it is the username or alias for a different existing            // user, then return it as a bad name.            if (DaoUtils.checkDuplicates(hibernate, user,                    QUERY_USER_IDS_BY_NAME_OR_ALIAS, user.getUserName())) {                result = user.getUserName();            } else {                // Check the aliases and return any duplicate as a bad name.                //                 for (Iterator iter = user.getAliases().iterator(); iter.hasNext();) {                    String alias = (String) iter.next();                    if (DaoUtils.checkDuplicates(hibernate, user,                            QUERY_USER_IDS_BY_NAME_OR_ALIAS, alias)) {                        result = alias;                        break;                    }                }            }        }                return result;    }