Chapter 32. Core Data Relationships

It is time to delve a bit deeper into Core Data. In Chapter 11, you dealt with a single entity (Car). In most applications, you will have multiple entities and relationships between them. Core Data supports to-one relationships and to-many relationships (ordered or unordered).

In this exercise, there will be two entities: Employee and Department. An employee will work for one department. A department will have a set of employees; one employee (chosen from its set) will be a manager. Thus, there are three relationships (Figure 32.1).

Figure 32.1. The Data Model

Image

Edit the Model

In this section, you are going to ...

Get Cocoa® Programming for Mac® OS X, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.