title: Learning Core Data. Entities, Adding and Loading
body: <p>So, I'm trying to use Core Data to save instances of a "Screenshot" class, which consist of:</p>
  
  <pre><code>NSString *note;
  NSData *screenshot;
  NSData *thumbnailOfScreenshot;  
  NSTimeInterval date;
  </code></pre>
  
  <p>In my Core Data file, i have two entities because i want to fetch the large images only when necessary, and only 1 at a time (it is to be used in a UITableView).</p>
  
  <p>Entity 1 is called Screenshot and consists of the 4 attributes above, whereas the *screenshot is transient. This entity also has a to one relationship with entity 2(an int called index).</p>
  
  <p>Entity 2 only has 1 attribute which is a Binary data field for the Large images. Also a to one relationship with entity 1.</p>
  
  <p>So, my first question: Is this remotely close to being correct? I'm a little unsure if i even need the Transient attribute "screenshot", in entity 1. <strong>And i am also confused if i need to create a new class for entity 2, which seems abit odd, since it will just contain the images.</strong> </p>
  
  <p>For now, I'm only trying to add and load instances to and from the DB. 
  Here is how i (think) i add an instance to the DB, but i am not sure it actually puts it in the DB right away?:</p>
  
  <pre><code>Screenshot *s = [NSEntityDescription insertNewObjectForEntityForName:@"Screenshot" inManagedObjectContext:context];
  </code></pre>
  
  <p>I am in over my head, so any help will be appreciated. I have read several guides, but none was targeting something similar to this.</p>