If you want to copy the object entity, you can use clone java action from Community Commons https://marketplace.mendix.com/link/component/170 .
To use the java action you are referring too, you will need to use it in a microflow and then add the entities in the value fields of the java action.
You could create a Microfow and in this Microflow retrieve Entity 1.
Then use a For Loop and create for each Object in this List Entity 2 and set there the Values of Entity 1
Hope this Helps