Duplicate data retrived from DB

I want to duplicate the data retrived from databse and want to commit both the original and duplicate data in the database. Could you please help on this process how to handle.
2 answers

If I am not wrong, you are looking for some sort of way to clone (like a copy).

Another option I would suggest if you dont want to manually do it:

  1. Retrieve the object
  2. Use Community commons module clone or deepclone
  3. Refer Community commons documentation for implementation details


  1. Retrieve the object/list
  2. if list retrieved, add loop and iterate over retrieved list
  3. Add create object with change members mapping original object 
  4. Commit New object – retrieved object not needed to commit, unless changes are made there as well