And then you can just write a cover method in the master to get the array of slaves and return null if the array is empty and return the single objectAtIndex(0) if it has the optional slave in the array. .... this has the added benefit that the master may someday have many slaves so he has do do no work at all ;-) .... and your EOModel will not have to be changed!

On Apr 5, 2006, at 2:45 PM, Art Isbell wrote:

On Apr 5, 2006, at 7:17 AM, Randy Wigginton wrote:

How do I set up an optional relationship from master to slave, such that the primary key from master (ID) is propagated into Slave?

From <file:///Developer/ADC%20Reference%20Library/documentation/WebObjects/UsingEOModeler/index.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."

In your situation, the foreign key is the primary key of the source entity.  Because a primary key cannot be null, the relationship cannot be optional, so model it as a to-many relationship.

Aloha,
Art

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

 _______________________________________________
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]

Reply via email to