Hi All,

I feel odd asking this.  It used to be that if I had a to-many relationship 
named "foos" and the relationship was setup in the entity modeler to own the 
destination objects, then removing objects from the relationship would cause 
EOF to delete the objects from the database during saveChanges().  I have the 
inverse to-one setup with a delete rule of Nullify.  

However, when I saveChanges() the Foo objects removed from the to-many are 
being updated to set the inverse to-one with null which blows up because the 
database does not accept a null value to avoid orphan Foo objects.  

I'm using Wonder and I see EOGenerator generating the following method in my 
_Parent.java :

    public void deleteFoosRelationship(Foo object) {
        removeObjectFromBothSidesOfRelationshipWithKey(object, "foos");
    }

which I think is correct.  But EOF is not doing the right thing when I 
saveChanges().  Has this changed or something?

If I go to the entity modeler and uncheck "Owns Destination" then EOGenerator 
generates the following:

    public void deleteFoosRelationship(Foo object) {
        removeObjectFromBothSidesOfRelationshipWithKey(object, "foos");
        editingContext().deleteObject(object);
    }

Notice the addition of editingContext().deleteObject(object).  So that fixes my 
problem but I could swear that EOF used to delete the objects from the to-many 
during saveChanges() when the to-many was setup with "Owns Destination" without 
me requiring to do editingContext().deleteObject(object).

Anybody care to confirm or has some ideas?

Thanks,
Ricardo


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to