When you use CascadeType.ALL
, whenever you do any operation on the parent all those operations would also get cascaded to the child.
Yes you should call saveOrUpdate(parent)
In your case as the parent objects are already existing. You could load the existing parent and create a new child and attach the child to parent and when you call saveOrUpdate(parent), it should update the parent and create all those child and relate it to that parent.
Yes it is generating a id for child, because it is trying to create a child due to cascade all and you could have configured it to generate id in @Id.
Enable sql logs using hibernate.show_sql
to understand better whats happening.
I assume you would have a @JoinColumn
in your child which would map to the parent primary key.