Re: Relationship delete rules

Chuck Hill <[email protected]>
Newsgroups gmane.comp.web.webobjects.devel
Message-ID <[email protected]>
Your delete rules sound backwards.

Chuck

On Apr 9, 2008, at 1:34 PM, Jeff Dunnett wrote:
> Hello,
>
> I have an object A that has a one-to-one relationship to object B.   
> The delete rule for this relationship is nullify.  Object A has a  
> field (foreign key) that is the primary key of Object B.  Object B  
> has a one-to-one relationship with Object A.  The delete rule for  
> that relationship is cascade.
>
> I have a piece of code that looks like this:
>
>             ec.lock();
>
>             for(int i = 0; i < objects.count(); i++){
>                 A a = (A)objects.objectAtIndex(i);
>
>                 if(a.b() != null){
>                     ec.deleteObject(a.b());
>                 }
>             }
>
>             ec.saveChanges();
>             ec.unlock();
>
> This code runs without throwing any exceptions.  I believe that once  
> this code has ran the field in Object A that is is the foreign key  
> (i.e. the primary key of Object B) should be null.  Am I correct in  
> thinking this?  For some reason after the code has ran the foreign  
> key in Object A is not null.  Is my interpretation of how the delete  
> rule works incorrect?  What else might I be doing wrong?
>
> Regards,
> Jeff
>
>
> _______________________________________________
> WebObjects-dev mailing list
> [email protected]
> http://www.omnigroup.com/mailman/listinfo/webobjects-dev

-- 

Practical WebObjects - for developers who want to increase their  
overall knowledge of WebObjects or who are trying to solve specific  
problems.
http://www.global-village.net/products/practical_webobjects
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.