Hi Ricardo,
On 2011-07-07, at 1:52 PM, Ricardo J. Parada wrote:
> 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.
What is the delete rule for the to-many? I think I needs to be No Action.
Owns Destination, Propagates Primary Key, and the Delete Rules have
interactions which are not easy to remember.
Chuck
> 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/chill%40global-village.net
>
> This email sent to [email protected]
--
Chuck Hill Senior Consultant / VP Development
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
_______________________________________________
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]