+ Group merged = em.merge(aGroup);
+ // Need to flush so that version of the merged instance is updated so we can use
+ // the updated version in the original group passed in. That allows the same
+ // group object to continue to be used as a detached object.
+ em.flush();
+ JpaMergeSupport.merge(merged, aGroup);