DaoUtils.checkDuplicates(hibernate, gateway, NAME_PROP_NAME, new DuplicateNameException( gateway.getName()));
DaoUtils.checkDuplicates(hibernate, gateway, "name", new DuplicateNameException(gateway .getName())); DaoUtils.checkDuplicates(hibernate, gateway, "serialNumber", new DuplicateSerialNumberException(gateway.getSerialNumber()));
    public void storeGateway(Gateway gateway) {        // Before storing the gateway, make sure that it has a unique name.        // Throw an exception if it doesn't.        HibernateTemplate hibernate = getHibernateTemplate();        DaoUtils.checkDuplicates(hibernate, gateway, NAME_PROP_NAME, new DuplicateNameException(                gateway.getName()));        // Store the updated gateway        hibernate.saveOrUpdate(gateway);    }