Re: Inverse to-one relationships
Re: Inverse to-one relationships
- Subject: Re: Inverse to-one relationships
- From: Chuck Hill <email@hidden>
- Date: Thu, 22 Jul 2010 15:02:54 -0700
On Jul 22, 2010, at 2:56 PM, Paul Hoadley wrote:
> Sorry, I should have tried to be clearer. Basically, I've got a parent object B (which will always be created first). At some point, B may obtain at most one child A, but it doesn't necessarily. So every B has zero or one child As. Every A has exactly one parent B.
>
> Currently I have a mandatory to-one relationship from A to B (so A knows its parent directly). To avoid some fetching, I have added an optional to-one relationship from B to A, so B knows its child if it has one. I assume there's no way to make these relationships inverses from EOF's perspective, and that I will just need to be careful about always setting the B to A relationship on creation of an A.
How did you model this? B hold's the PK of A as a FK? They each need a FK for the other, I think. Your relationships should be
B.FKA == A.PK
A.FKB == B.PK
I think...
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden