String sql = "from Currency where siteId = :siteId order by currencyCode";
Query query = em.createQuery(sql);
query.setParameter("siteId", Constants.SITE_SYSTEM);
Iterator<?> iterator = query.getResultList().iterator();
while (iterator.hasNext()) {
Currency master = (Currency) iterator.next();
Currency currency = new Currency();
PropertyUtils.copyProperties(currency, master);
currency.setSite(site);
currency.setCurrencyId(null);
currency.setRecUpdateBy(userId);
currency.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
currency.setRecCreateBy(userId);
currency.setRecCreateDatetime(new Date(System.currentTimeMillis()));
em.persist(currency);
}
}