Re: Inverse to-one relationships
Re: Inverse to-one relationships
- Subject: Re: Inverse to-one relationships
- From: Paul Hoadley <email@hidden>
- Date: Fri, 23 Jul 2010 07:26:22 +0930
Hi David,
On 23/07/2010, at 6:33 AM, David Avendasora wrote:
> I'm not 100% clear on how this is modeled.
>
> 1) Does the A.b() relationship propagate PKs?
No.
> 2) Are you saying that the A.b().a() may be null?
No, never. A.b().a() would always give A.
> In other words, are you saying A.fetchAllAs().valueForKey(B_KEY) may not return an Array with the same objects that B.fetchAllBs(ec, B.A.isNotNull()) ?
No, I'm not saying that. Those two expressions would return the same objects.
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.
--
Paul.
http://logicsquad.net/
_______________________________________________
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