title: Core-Data CoreDataGeneratedAccessors vs. simple assignment
body: <p>I have a 1-to-many relationship in a Core Data graph, and I'm trying to understand the difference between using a CoreDataGeneratedAccessors method and a simple assignment to alter a relationship.  For example, the <a href="http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/CoreData/Articles/cdUsingMOs.html" rel="nofollow noreferrer">Core Data Programming Guide</a> has a department and employee example.  In that example they use the CoreDataGeneratedAccessors to hire and fire employees:</p>
  
  <pre><code>[aDepartment addEmployeesObject:newEmployee];
  [aDepartment removeEmployeesObject:firedEmployee];
  </code></pre>
  
  <p>They don't define an inverse relationship, but say "department" is the inverse relationship to "employees".  Should the following then accomplish the same thing?</p>
  
  <pre><code>newEmployee.department = aDepartment
  firedEmployee.department = nil;
  </code></pre>
  
  <p>According to the <a href="http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/CoreData/Articles/cdRelationships.html#//apple_ref/doc/uid/TP40001857-CJBDBHCB" rel="nofollow noreferrer">Manipulating Relationships and Object Graph Integrity</a> section of the Core Data Programming Guide, the later examples should automatically fix all relationships to maintain graph consistency.  If that's the case, is there any reason to use the CoreDataGeneratedAccessors when an inverse relationship exists?  Does using the CoreDataGeneratedAccessors maintain graph consistency on inverse relationships?</p>