i have a grails job which is updating the totalSellCount of a product, for which i run a loop , i have a map productTotalSellCount which have the identifier of each product with its total sell count , now i am iterating the loop to update all product sell count like this
productTotalSellCount.each { k,v ->
Product product = Product.findByIdentifier(k)
product.totalSellCount = productTotalSellCount.get(k)
product.save(flush: true)
}
i have around 50k products , and this is a daily schedule job and it always fails , help !!