• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Non Compulsory toOne Relationships, Propergating Primary Key
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non Compulsory toOne Relationships, Propergating Primary Key


  • Subject: Re: Non Compulsory toOne Relationships, Propergating Primary Key
  • From: Chuck Hill <email@hidden>
  • Date: Fri, 7 Dec 2007 10:51:15 -0800


On Dec 6, 2007, at 11:50 PM, Art Isbell wrote:

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.


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

Typo: should read "from a primary 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

--

Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects






_______________________________________________
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


  • Follow-Ups:
    • Re: Non Compulsory toOne Relationships, Propergating Primary Key
      • From: Art Isbell <email@hidden>
References: 
 >Non Compulsory toOne Relationships, Propergating Primary Key (From: Owen McKerrow <email@hidden>)
 >Re: Non Compulsory toOne Relationships, Propergating Primary Key (From: Art Isbell <email@hidden>)

  • Prev by Date: Re: SSDD vs War
  • Next by Date: Re: SSDD vs War
  • Previous by thread: Re: Non Compulsory toOne Relationships, Propergating Primary Key
  • Next by thread: Re: Non Compulsory toOne Relationships, Propergating Primary Key
  • Index(es):
    • Date
    • Thread