Re: Non Compulsory toOne Relationships, Propergating Primary Key
Re: Non Compulsory toOne Relationships, Propergating Primary Key
- Subject: Re: Non Compulsory toOne Relationships, Propergating Primary Key
- From: Art Isbell <email@hidden>
- Date: Thu, 6 Dec 2007 21:50:54 -1000
On Dec 6, 2007, at 8:18 PM, Owen McKerrow wrote: I have the following relationship :
GROUP <-- --> RQF_GROUP
where a group may have a RQF Group object, but the RQF Group object must belong to a group.
As its a to one I want it to propagate its primary key across, however when I tick this box WO is nice and helpful and inserts a new RQFGroup object every-time I make a new Group, even thought I have specified that the relationship is optional. Is there any way to stop this from happening ?
If I understand correctly, you want the primary key of the RQF_GROUP object to be the same as that of GROUP object. If so, you can't have an optional to-one relationship in which the foreign key of the GROUP.RQF_GROUP relationship is non-null. The foreign key of this relationship can't be null because it's the GROUP object primary key. So WO graciously creates an RQF_GROUP object for you which isn't what you want.
A to-one relationship from one foreign key to a primary key must always have exactly one row in the destination entity—if this isn’t guaranteed to be the case, use a to-many relationship. This rule doesn’t apply to a foreign key to primary key relationship where a null value for the foreign key in the source row indicates that no row exists in the destination.
Aloha,
|
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