Validation / relatonship problem
"Clark, Igor" <[email protected]> Wed, 19 Nov 2003 15:41:10 -0000
| Newsgroups | gmane.comp.web.webobjects.eof |
|---|---|
| Message-ID | <D808EA148335074698927652E8E5182F0333E98F@ukapphdevmsx01.ukapd.astrazeneca.net> |
Hi list, I have objects of types A <-->> B. A has a relationship "toBs" and B has a relationship "toA". If I retrieve the A object anA and enumerate immediately through its toBs NSArray, the EODebug shows me that as expected, 2 SELECTs are carried out, first to retrieve the A object and second to retrieve its associated B objects, and I can print out toBs.objectAtIndex(x).someValue() with no problem. I then call ec.deleteObject(anA); ec.saveChanges(), to check my validateForDelete() method in the A class. In the validateForDelete method I try to do exactly the same enumeration, only to discover that the NSArray returned by this.toBs() is an empty array with a count() of 0. Yet if I set the toBs relationship in the model to be "deny", then the validation fails, as expected, with the message "Removal of 'A' object denied: in its 'toBs' relationship, there are related objects". Why does the toBs method return an empty array in validateForDelete()? Thanks, Igor Clark.