You can use merge() instead of persist() in this case:
foo = entityManager.merge(foo);
When applied to the new instance, merge() makes it persistent (actually – returns the persistent instance with the same state), and merges cascaded references, as you try to do manually.