DialingRule ruleDup = (DialingRule) duplicateBean(rule, "dialingRuleIdsWithName");
DialingRule ruleDup = (DialingRule) duplicateBean(rule, DIALING_RULE_IDS_WITH_NAME_QUERY);
    public void duplicateRules(Collection selectedRows) {        DialPlan dialPlan = getDialPlan();        List rules = dialPlan.getRules();        Collection selectedRules = DataCollectionUtil.findByPrimaryKey(rules, selectedRows                .toArray());        for (Iterator i = selectedRules.iterator(); i.hasNext();) {            DialingRule rule = (DialingRule) i.next();            // Create a copy of the rule with a unique name            DialingRule ruleDup = (DialingRule) duplicateBean(rule, "dialingRuleIdsWithName");            rules.add(ruleDup);        }        DataCollectionUtil.updatePositions(rules);        getHibernateTemplate().saveOrUpdate(dialPlan);    }