It seems you're not really understanding that Java works with references. You don't need to get the collection of steps from the entity, construct a copy, add elements to the copy and set the collection of the entity to this copy. All you need to do is add an element to the collection of steps of the entity:
entity.getStep(s).add(...);
You also assume that the entities will always be in the collection in the same order (step1, then step2). That's not the case. First of all because a Set doesn't have any order. Second because, even with a List, if you don't sort the list, or order it using an OrderColumn, the list is in fact a bag, where the order of the elements is arbitrary.
That said. The main problem is, once again, that you're modifying only the inverse side of the association, without modifying the owner side. The owner side is Step.work
. That's what you need to modify to set/remove the association. So, to add a new step:
Step step = new Step();
step.setWork(work); // mandatory
em.persist(step);
work.getSteps().add(step); // optional, but needed to keep the coherence of the object graph
To update the label of a step:
Set<Step> steps = work.getSteps();
Step step1 = findStepHavingLabel(steps, "stepOne");
step1.setLabel("changed");
To disconnect a step from its work:
Set<Step> steps = work.getSteps();
Step step1 = findStepHavingLabel(steps, "stepOne");
step1.setWork(null); // mandatory
steps.remove(step1); // optional, but needed to keep the coherence of the object graph