By maintain bi-directional relationships, I mean when you add the
StateAssignment to the OneToMany, you also set the ManyToOne in the
StateAssignment back to its parent.
In general be careful with merge, as it is meant for use with detached
copies, avoid using it on managed objects, as they are already managed.
Also avoid relating managed objects with detached copies, and be careful
in dealing with copies in general. It is very easy for copies to get
mixed up and you may get two different copies of the same object in the
same object graph, which can lead to issues.