• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Question about 1-to-many relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about 1-to-many relationship


  • Subject: Question about 1-to-many relationship
  • From: "Ricardo J. Parada" <email@hidden>
  • Date: Thu, 07 Jul 2011 14:52:45 -0400

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@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Question about 1-to-many relationship
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: Apple Representation On WebObjects-Dev Mailing List?
  • Next by Date: Mobile Device site rewrite rule
  • Previous by thread: Re: Apple Representation On WebObjects-Dev Mailing
  • Next by thread: Re: Question about 1-to-many relationship
  • Index(es):
    • Date
    • Thread