Core Data Relationships in pre-populated SQLite database

Posted by Cardinal on Stack Overflow See other posts from Stack Overflow or by Cardinal
Published on 2010-06-09T03:32:08Z Indexed on 2010/06/09 3:42 UTC
Read the original article Hit count: 279

Hi All,

I'm new to Core Data.

Currently I have following tables on hand:

tbl_teahcer   tbl_student   tbl_course      tbl_student_course_map
-----------   -----------   ----------      ----------------------
teacher_id    student_id    course_id       student_id 
name          name          name            course_id   
                            teahcer_id      

And I'm going to make the xcdatamodel as below:

Course                  Teacher             
------                  -------                         
name                    name                            
teacher  <<---------->  courses   
students <<---|
              |         Student
              |         -------
              |         name   
              |----->>  courses

My questions are as follows:

  1. As I'd like to create TableView for Cource Entity, is it a must to create the Inverse Relationship from Teacher to Course, and Student to Course? What is the beneit for having the Inverse Relationship?

  2. I got some pre-defined data on hand, and I'd like to create a SQLite storage for pre-populated source. How can I set up the relationships (both directions) in SQLite?

Thank you for your help!

Regards, Cardinal

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data