Given two EJBs "Master" -----(1..*) ---> "Detail".
What is the corret way of removing all "Detail" objects belonging to "Master" ?
I have tried this:
for (Iterator iter=master.getDetails().iterator();iter.hasNext();) {
Detail detail = (Detail)iter.next();
detail.remove();
}
But only the first of two "Detail" objects are removed.
Where did I go wrong?
It seems that the iterator returned from the CMR field is confused.
printing the contents of the iterator after each remove gives:
iterator.size() --> 1
iterator.hasNext() --> False
Perhaps this is a bug?