Re: Validation / relatonship problem

Ricardo Strausz <[email protected]> Mon, 24 Nov 2003 13:19:53 -0600
Newsgroups gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
I am not realy sure, but it seem to me like a Foult problem...
that is, the *childs* are not instanciated since the begining of the 
"life-cycle" of the *father*, insted they are treated as NSFaults; but 
I am not sure at this moment when they are supposed to be retrived from 
the db!?
Does it make sense?
Dino

On Nov 19, 2003, at 9:41 AM, Clark, Igor wrote:

> 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.
> _______________________________________________
> EOF mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/eof