Re: Multiple One-to-One Core Data relationships & inverse
Re: Multiple One-to-One Core Data relationships & inverse
- Subject: Re: Multiple One-to-One Core Data relationships & inverse
- From: Frédéric Testuz <email@hidden>
- Date: Fri, 7 Sep 2007 15:27:39 +0200
Le 7 sept. 07 à 14:36, Frank Reiff a écrit :
Hi,
This is probably a stupid newbie question again, but I can't get my
head around this..
The Core Data documentation makes a big deal about the fact that
each relationship should have an inverse & the compiler now even
throws a warning when there isn't an inverse.
What I don't get is this how this is supposed to work with multiple
role based one-to-one relationships ("has a").
Say you have a money transfer entity that takes a debit and a
credit account.
You'll have:
MoneyTransfer:
creditedAccount one-to-one relationship to Account
debitedAccount one-to-one relationship to Account
Now Account should have an inverse relationship for this!?
The inverse could either go to creditedAccount or debited account,
but not both..!?
What am I missing?
You are missing that you have not one, but two inverse relationship.
One for debit and one for credit.
And the relationship is not one to one relationship, but one to many.
Each account will have many credit and debit transfers. You can have
something like :
MoneyTransfer: Account :
creditedAccount <<---> creditTransfers
debitedAccount <<---> debitTransfers
Best regards,
Fred_______________________________________________
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