Re: D2W does not do addObjectToBothSidesOfRelationshipWithKey
Re: D2W does not do addObjectToBothSidesOfRelationshipWithKey
- Subject: Re: D2W does not do addObjectToBothSidesOfRelationshipWithKey
- From: Robert Walker <email@hidden>
- Date: Thu, 12 Jul 2007 18:28:18 -0400
Then it is not a true 1:1 as one a may have many b’s and one b may have many a’s. Thats what Robert meant by not being a true 1:1. If you join a PK to an FK you always have a 1:n
Exactly. Since this is not one of the two relationships is not an inverse of the other then addObjectToBothSidesOfRelationshipWithKey won't work, because it will not find an inverse relationship. What you have are two separate, unidirectional, relationships that D2W won't manage for you.
a-pk<--b-fk a-fk --> b-pk
not the same as: a-pk<-->b-pk (true one-to-one)
not the same as: a-pk<-->>b-fk (one-to-many)
D2W/EOF should manage these properly using addObjectToBothSidesOfRelationshipWithKey because it can find the inverse relationships using:
public String inverseForRelationshipKey(String relationshipKey)
or whatever magic it uses to find the inverse. On Jul 12, 2007, at 5:19 PM, Alexander Spohr wrote:
Am 12.07.2007 um 22:56 schrieb Johan Henselmans:
On 12-jul-2007, at 21:58, Robert Walker wrote:
Johan,
Is this truly a one-to-one relationship as modeled? I mean are the tables joined PK <----> PK? Or is this modeled as a one-to-many with the many-side limited to one related object in the array?
it is like:
a-pk<--b-fk a-fk --> b-pk
So the foreign key of table a points to the primary key of b and vice versa, so one can find a via b and find b via a.
If this is a true PK to PK one-to-one relationship, which way have you set "Propagates Primary Key?" If it's a true one-to-one it's that property of the model that is responsible to setting the destination PK.
I think we're not talking about the same type of relationships. Bot tables exist, they can not have one of the primary keys propagated, as it is not know beforehand which one of the records will relate to which record in the other table.
Then it is not a true 1:1 as one a may have many b’s and one b may have many a’s. Thats what Robert meant by not being a true 1:1. If you join a PK to an FK you always have a 1:n
Anyway, D2W should always call addObjectToBothSidesOfRelationshipWithKey. If it does not, it has a bug.
atze
|
_______________________________________________
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