Hi Friends,
I've a usual scenario where parent has @OneToMany uni-directional relationship with child. And I specified the cascade type = ALL. So whenever I insert the parent its child recored also gets inserted and whenever I updated the parent the child recored also gets updated.
Is it possible to insert a set of new child records while updating the parent record?
And also is it possible to delete the child record while updating the parent record?
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
1. Is it possible to insert a set of new child records while updating the parent record? Sorry for this question, I tried and works fine. Yes its possible to insert a new child record while updating the parent record.
2. Is it possible to delete the child record while updating the parent record? we've 3 tables as below
1. Parent
2. Child
3. Parent_Child
If I delete the child record while updating the parent the mapping in the table 'Parent_Child' alone gets deleted. But the child data in table 'Child' still exist.
In my scenario I want to delete the child record too.
If I delete the child record while updating the parent the mapping in the table 'Parent_Child' alone gets deleted. But the child data in table 'Child' still exist.
In my scenario I want to delete the child record too.