Regarding @OneToMany , if I want to remove a child, do I need to explicitly delete this child from the parent collection, or is it enough to remove the child?
For example, Personand Phone. Each person has many phone numbers. If I want to delete one phone number from a person, it’s enough:
EntityManager.remove(phone);
Or I need this in advance:
Person.getPhone().remove(phone);
Not to mention, the CascadeType parameter is set to MERGE .
source
share