this will help What I did is, instead of a map, use separate collections for the parent and child objects. After that I just persisted the parent object collection and that was It (because child object can't exist without a parent object, but parent can without child objects, otherwise I could also instead persist the child objects). So the problem with map was, that although you add a value to a specific keys collection values from another keys collection values, It does not reference the same object, i.e. It creates a new one for the other key collection, which is why in this case you get duplicates when persisting the key values (which are the parent objects).
Wildfly 8.2 - Hibernate JTA Remove fails with Removing a detached instance (allready merged)