Re: Core Data question
Re: Core Data question
- Subject: Re: Core Data question
- From: Sandro Noel <email@hidden>
- Date: Sun, 10 Aug 2008 21:39:07 -0400
Greetings.
I've read the documentation on core data over again, and I'm still
confused about how to manipulate relationships.
every time I try an insert/add and there is a relationship involved,
the insert crashes.
(programatically that is, bindings work just fine)
maybe, the way I think it is just not right, you see I think it in
terms of SQL,
I've done SQL fir the past 17 years, so. it's kind of hard to think
otherwise.
table Account
table Account details.
Relationship: Account <-------one to many----------->> AcountDetails
If I want to insert an account detail, the foreign key of that account
detail will be linked to the Primary key of the Account.
usually I use the auto-incremented id's, if I enforce integrity on
that relationship, there is no way I will be able to insert
an account detail if the account I want to link to is non existent.
If I want to use an specific account i'll just query the database and
ask the user to choose an account, i'll keep it's ID
and use it for the future inserts.
In Core Data, I'm out of clues on how to insert an object that has a
relationship.
I've tried to query the account table for the NSManagedObject, and
assign it to the property account in my account details object.
but that failed. Then I tried using the account name as a string and
assign it to the same property, and, well it failed.
So I think my question here, is, what should I use when inserting a
detail object to properly set the relationship to Account.
some example on how I should approach the problem would be nice, or a
step-by-step :D
Thank you in advance!
Sandro.
_______________________________________________
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