I have , for example, two entities called Class
and Student
.
Both entities are connected by a One-To-Many relationship, "Class" has a ClassID field and Student has both a ClassID and StudentID fields.
I have a couple of questions on this situation:
- When I define a Connection between Class and Student, are they connected by ClassID , or Core Data creates its own connection somehow?
- After having a Class entity already saved, lets say I want to add a Student to it. Could I just add a new Student with that ClassID, Or I would have to get the Class object, add a student to its .students NSSet object, and save it back to Core Data ?
- If the latter option is the only option, how would I go on updating a record in Core Data? Fetch is with a NSFetchRequest, change it and than just save the Managed Object Context again ?
Sorry for the many question and I greatly appreciate any assistance on this :)