title: Core Data: Relationships and User Objects
body: <p>I'm using StackMob with CoreData (remote Database), but I think this is a general Core Data question.</p>
  
  <p>I have 3 entities: </p>
  
  <ol>
  <li>User (login) </li>
  <li>Cars </li>
  <li>Bikes</li>
  </ol>
  
  <p>Each entity has several attributes.</p>
  
  <p>A User can have multiple Cars and Bikes objects (to-many relationship).  Cars and Bikes can only have one owner (User) (inverse to-one relationship). </p>
  
  <p>Now lets say we have 2,000 Users.  Each User is a car dealer and has 500 cars and 300 bikes records/objects stored in CoreData.  I would like the User to fetch based on attributes of Cars and Bikes.  I plan to use predicates for this.  To cut back on constant fetch request, I also plan to use Cache. </p>
  
  <p>However, the questions I have  are: </p>
  
  <ol>
  <li><p>How should I save the record/object under each User?  Is there a term for that in CoreData?  </p></li>
  <li><p>I would like the User to login and be able fetch all the Cars/Bikes based on its attributes (Model, Manufacture, DateStamp, etc.) only within the objects the User created.  I guess what I'm trying to avoid is when the User does a fetch request based on attributes in the Cars and Bikes entity, it only searches under its own User objects.  I don't want the fetch request to search through all the others User's objects because that would be a waste as I'm afraid that'll slow down the app.  What's the best way to set this up in CoreData?</p></li>
  </ol>
  
  <p>Just went though 2 core data books and I'm not sure how to approach this.  I know I'm not the brightest so I turn to the experts for some advice.  Thank you.  </p>