AFAIK you can avoid this issue by first saving the child and then saving the parent.
child = em.save(child); parent.getChildren().add(child); em.persist(parent);