tags:

views:

73

answers:

1

Hi guys, I don't know whether this question has been asked before or not. But i was trying to use cascading delete, but couldn't find enough documentation to get my answers that is why Im asking here.

I have one parent class and two child classes dependent on that. When i delete parent it should delete the other two child classes as well.

Question: 1) Where do I need to put the set and key thing(in parent hbm file or in two child hbm files). 2) And if I need to put in parent hbm, do i need to put two set for each of the child classes.

A: 

1) Yes. 2) You need to use all-delete-orphan cascade settings on both child mappings in parent hbm file.

Reference found here, here and here

Sathish Naga
thnx for the info, I have defined the two sets into my parent hbm file.But im getting this error "XML validation error: The 'name' attribute is not declared". This error im getting where i have defined the key name for the first set.But I already have a FK relationship between the parent and the 1st child.
alice7
Can you show me the child mapping section?
Sathish Naga