Editing an attribute of an NSManagedObject fires fault for to-many relationships of that object?

  • In my CoreData application, I've noticed an unexpected number of
    fetches from an SQL store. I traced these fetches to setting an
    attribute of an object from that store. The attribute in question is a
    Boolean attribute, but chaning its values fires the fault for the
    to-many relationships of that object as well. Since these fetches
    sometimes take seconds, this behavior adds unacceptable delay to the
    user interface when the user just wants to change the value of a
    checkbox.

    A demo project that exhibits the behavior in question can be
    downloaded at http://rieke-server.physiol.washington.edu/~barry/CoreDataFaultLab.zip.

    In this app, the Managed Object Model contains an Entity Foo which has
    two attributes and two to-many relationships to Entities Bar and Baz.
    The UI is the IB-generated UI for managing many Foo objects. The
    executable has com.apple.CoreData.SQLDebug set to 2. If you run the
    project's app, add a Foo to the document and save, then reopen, you
    will notice that the run log shows a fetch for the bar and baz to-many
    relationships of Foo if you edit either of the attributes of the saved
    Foo instance.

    Why are these faults fired when the user edits a simple property of
    the Foo object? Is this a known bug? Is there a way to prevent these
    faults from firing?

    Any suggestions or advice greatly appreciated!

    thanks,
    Barry
previous month september 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Go to today