re: Fetch Requests on Non Standard Classes in Core Data
re: Fetch Requests on Non Standard Classes in Core Data
- Subject: re: Fetch Requests on Non Standard Classes in Core Data
- From: Ben Trumbull <email@hidden>
- Date: Sun, 17 May 2009 15:10:11 -0700
To make matters worse though, the guid is wrapped in what is
effectively a
container class which includes network serialization functionality, an
isEqual method, etc along with the 16 bytes of guid data. If
possible I
would like to store the wrapper object in Core Data rather than
extracting
data from it and then rebuilding it each time I store/retrieve the
object.
It seems eminently possible to do the actual storage/retrieval using
an
NSValueTransformer with a Transformable attribute, but what is
hurting my
brain is the idea of lookups. How (if at all) can I store these
wrapper
objects in such a way that I can do fetch requests based on their
internal
values?
Transformable attributes are stored as binary blobs in the db. The
container class is strictly an artifact of the runtime in memory
representation.
Core Data supports == and != searches against binary data. You should
be able to just use a predicate like:
[NSPredicate predicateWithFormat:@"myTransformableAttribute = %@",
myGuidObject]
and have it "just work". If it doesn't on 10.5.7, please file a bug
report.
- Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden