On Dec 6, 2007, at 8:18 PM, Owen McKerrow wrote:
I have the following relationship :GROUP <-- --> RQF_GROUPwhere 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.
This situation is described in "Tips for Specifying Relationships" in the EOModeler User Guide at <http://developer.apple.com/documentation/WebObjects/UsingEOModeler/5WorkingWithRelationships/chapter_5_section_4.html >:
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, Art
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
