This work well to summarize the records in run time , but it doesnot work when the record with the same key exists in d/b and we are trying to INSERT another record with same key.
It kind of makes sense because without a map operation it behave as an INSERT and so error due to primary key violation