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