Should I need to have explicit custom ID attribute as PK for each of my core data entities? I’m aware of the fact core data uses its own objectID column for every entity and we can grab it from [NSManagedObject objectID].
My previous projects were done using raw SQLite, but now I’m trying to move to core data. Currently in my core data prototype, I’m filtering records using my custom ID column:
[fetchRequest setPredicate:[NSPredicate predicateWithFormat:@"my_id=%d",some_id_value]];
Just curious, should I bother myself with custom ID attributes, or should I rely on internal objectID column: pass it here and there, use for filtering, joining tables and etc?
The whole idea behind coredata is to avoid low-level sql. As in every modern ORM you should not be bothered with internal object ids. At first this may seem a little awkward (especially if you come from a heavy sql background) but believe me it is a lot more easier to manage your object graph this way. So bottom line, design your NSManagedObjects and relationships and let coredata do its magic with all the ids.