Re: Modeling optional one-to-one relationships correctly
Re: Modeling optional one-to-one relationships correctly
- Subject: Re: Modeling optional one-to-one relationships correctly
- From: Robert Walker <email@hidden>
- Date: Thu, 11 Jan 2007 11:27:04 -0500
And I suppose there is no way to "propagate" for example the primary key of B into A.bFid when you setBrelationship(A) ?
Yes this is correct. Primary key propagation can only happen in one direction, by definition. You either propagate from A to B or B to A.
Example:
1. EOF generates 5 for A. 2. EOF effectively skips PK generation for B because "Propagates Primary Key" is set on the A -----> B relationship. 3. EOF assigns 5 to B by propagating from A.
If "Propagates Primary Key" was also set on B -------> A it would be in conflict with the above. On Jan 11, 2007, at 10:37 AM, Fabrice Pipart wrote:
On Jan 11, 2007, at 4:20 PM, Robert Walker wrote: Fabrice,
The problem that you are having is related to primary key generation. There is no way for EOF to guarantee the generation of the same primary key values to two different entities. This is why modeling one-to-one relationships in EOF normally uses primary key propagation. What happens is that EOF would generate a new key for Entity A, then through propagation would assign that same key to the primary key of Entity B. The downside to this method is that you will always have a B for every A. This makes sense when you think about the object graph. Accessing B through the relationship in A needs to have a database row available when the fault representing B gets fired by accessing it.
And I suppose there is no way to "propagate" for example the primary key of B into A.bFid when you setBrelationship(A) ?
|
_______________________________________________
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