facing problem while deleting a child record in hibernate.
posted 11 years ago
I am trying to update a child records i have following scenario master record (having one to many assciation with child table cascade=all in .hbm.xml configuration file) ===> customerInfo detail record set (having many to one assciation with master table cascade=all in .hbm.xml configuration file) ===> customerAccountsSet
i do following steps to update a record 1) get the customerInfo objetc from session successfully 2) get the customerAccountsSet = customerInfo.getCustomerAccounts(); 3) traying to add a new customerAccount say customerAccount1 to be saved for the first time without primery key in it 4) traying to update a customerAccount say customerAccount2 to be updated with primery key in it 5) traying to add a delete customerAccount say customerAccount3 with primery key in it
only step 5 is not executed properly as i can still see the deleted record in db , although save and update steps have been successfully completed in db. can anybody tell me whats going wrong here.code for steps 2,3,4,5 is as follows in the same order 2)Set customerAccountSet = (Set) customerInfo.getCustomerAccounts(); 3)customerAccountSet.add(customerAccount); 4)customerAccountSet.add(customerAccount); 5)customerAccountSet.remove(customerAccount);