• 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
Re: Can't modify EO objects! ARGH! =(
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can't modify EO objects! ARGH! =(


  • Subject: Re: Can't modify EO objects! ARGH! =(
  • From: Art Isbell <email@hidden>
  • Date: Thu, 17 Jul 2003 13:11:07 -1000

On Thursday, July 17, 2003, at 11:59  AM, Albert Jagnow wrote:

I am confused by the pattern you list below.  I have had more problems
doing insert before populate.

As Chuck stated, these problems can be dealt with by making the changes in an editing context whose parent is the session's default editing context. If you decide not to save these changes, set this editing context to null so it is garbage collected. The session's default editing context won't realize any changes have been made.


If you do decide to save the changes, send a saveChanges() message to the nested editing context which moves the changes up to the session's default editing context. If this parent is the session's default editing context, then send a saveChanges() message to it to save to the DB.

Another possibly less flexible approach is to use just the default editing context. If you make changes that you don't want to save, send the editing context a revert() message.

EOF knows what SQL to generate based on the changes made to objects in an editing context. When you make changes to an object that's not in an editing context, then EOF can't possibly know what SQL to generate to apply these changes to the DB. You can get lucky by making changes that don't affect the SQL generated, but you can also get unlucky such that the changes that you have made won't get saved to the DB. One example of missed changes are foreign keys that aren't updated when a relationship value is set in an object that's outside of an editing context. So always insert a new object into an editing context before you make any changes to it.

Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Can't modify EO objects! ARGH! =(
      • From: Arturo PĂ©rez <email@hidden>
    • Re: Can't modify EO objects! ARGH! =(
      • From: Chuck Hill <email@hidden>
  • Prev by Date: Re: Can't modify EO objects! ARGH! =(
  • Next by Date: Re: EO Object Lifespan / Editing Context (Goodbye Bill)
  • Previous by thread: Re: Can't modify EO objects! ARGH! =(
  • Next by thread: Re: Can't modify EO objects! ARGH! =(
  • Index(es):
    • Date
    • Thread