Hibernate – Assotations/Relationship : Remove a Child From a Parent Object In OneTo Many :
To remove one child object of a parent object, the following steos are required.
1. load parent object.
2. Read a collection of child objects from parent.
3. Load child objects.
4. Remove a child object from collection with in a transaction.
For ex: The following code adds one more customers to a vendor.
1. Vendor v = (Vendor)session.get(Vendor.class,111);
2. Set set = v.getCustomers();
3. Customer c = (Customer)session.get(Customer.class, 504);
4.Transaction tx = session.beginTransaction();
set.remove(c);
tx.commit();
Hibernate Examples Project Github Link : https://github.com/SadaLearningHub1/H...