Re: Validating unique objects in CoreData
Re: Validating unique objects in CoreData
- Subject: Re: Validating unique objects in CoreData
- From: Roland King <email@hidden>
- Date: Fri, 12 Feb 2010 21:05:28 +0800
two questions, neither of which actually answers yours I think.
1) does this uuid need to be something you generate externally and then set onto the object? Each core data object already has an objectID which is guaranteed unique in the database, can you make use of that one instead? You are allowed to keep that and use it to find objects later.
2) Where does the uuid on the object you are inserting come from? If you are setting a UUID on the objects when you are creating them then using one of the uuid_generate functions the UUID generated can be 'reasonably considered unique amongst all UUIDs created on the local system, and among UUIDs created on other systems in the past and in the future' (from the manpage). If you generate them in such a way, you don't have to care about checking them to be unique, they already will be.
On 12-Feb-2010, at 7:45 PM, malcom wrote:
> Hello,
> I would use CoreData in order to mantain an archive of objects: each object contains an attribute called "uuid"; in the same db only one object can have the same attribute value. This mean I should validate the proposed new object to insert and check if the another object with the same uuid is inside the storage. I've implemented it with a fetch request but it's so slow when there are lots of objects to insert (my db contains around 30,000 objects).
> Any idea to improve performance of this check? Can CoreData support unique attributes as like key in sql database?
> Thanks
> mmc_______________________________________________
>
> 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
_______________________________________________
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