Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

facing problem while deleting a child record in hibernate.

 
sajjad ahmad
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Report post to moderator
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);
 
sajjad ahmad
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Report post to moderator
ooops sorry for this double post.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thanks for realizing that. You know you can go into the Edit Post button and delete your duplicate thread.

In this case, I am just going to close this thread for you.

Mark
 
    Bookmark Topic Watch Topic
  • New Topic