Re: addObjectsToBothSide... not really both side
Re: addObjectsToBothSide... not really both side
- Subject: Re: addObjectsToBothSide... not really both side
- From: Zak Burke <email@hidden>
- Date: Tue, 26 Sep 2006 11:45:05 -0400
Dev WO wrote on 9/25/06 1:26 PM:
> So this one is a oneToOne relationship, with is specified in both
> entities A and B.
[...]
> A and B have a foreign key to each other, but only A gets it... B's
> foreign key stay "null".
I think you may not be modeling the relationship correctly. If you
really want a 1-to-1, A and B should share the same primary key and A
should be propagating its primary key to B.
If both tables have their own primary keys, and both have foreign keys
to each other, things don't really stand up from a relational logic
point of view because you actually have two relationships -- A is joined
to B by by A.b_id and B is joined to A by B.a_id.
Assuming that A.setB() is defined in terms of A.b_id, the reason B.a_id
doesn't update is that B.a() is defined by B.a_id but the relationship
you just set is defined by A.b_id. You have two separate relationships
based on two separate keys.
zak.
_______________________________________________
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