Wait a second… thinking about this more.

If you are going A -> B where A has a primary key and you have a two one 
relationship to B where you “propagate” primary key - this is a very bad 
thing!!!!!!

What it means is the PK of A also points to the PK of B… it will always think 
there is a B… so it “has to” make an EO over there. 

You would be better off making a new integer FK on A pointing to B. Do not 
propagate primary key.

AARON ROSENZWEIG / Chat 'n Bike <http://www.chatnbike.com/>
e:  aa...@chatnbike.com <mailto:aa...@chatnbike.com>  t:  (301) 956-2319        
        
        

> On Jan 13, 2019, at 12:42 PM, Johann Werner <johann.wer...@posteo.de> wrote:
> 
> 
> 
>> Am 13.01.2019 um 18:37 schrieb Ricardo Parada <rpar...@mac.com>:
>> 
>> When I create A will it have a B set in the to-one?
> 
> I think so. It is a loooong time ago I used key propagation though.
> 
>> 
>> Ricardo
>> 
>>> On Jan 13, 2019, at 12:35 PM, Johann Werner <johann.wer...@posteo.de> wrote:
>>> 
>>> Hi Ricardo,
>>> 
>>> don’t fight the system ;-)
>>> 
>>> When you have your to-one relationship A -> B with key propagation just 
>>> create an instance of A and you automatically have a B in place when you 
>>> check the relationship A.toB(). You just have to (re)use the present B 
>>> instead of creating and connecting your own B.
>>> 
>>> jw
>>> 
>>> 
>>>> Am 13.01.2019 um 13:07 schrieb Ricardo Parada <rpar...@mac.com>:
>>>> 
>>>> Hi Johann,
>>>> 
>>>> My workaround is to model the relationship as a to-many propagating the 
>>>> primary key.   It’s less elegant but at least it works. 
>>>> 
>>>> Thanks 
>>>> Ricardo
>>>> 
>>>>> On Jan 13, 2019, at 7:02 AM, Johann Werner <johann.wer...@posteo.de> 
>>>>> wrote:
>>>>> 
>>>>> Hi Ricardo,
>>>>> 
>>>>> when using pk propagation I vaguely remember that EOF is automatically 
>>>>> creating an instance of the dependent entity. Thus when you create a 
>>>>> second object B and set the relationship to A the auto created object is 
>>>>> left without connection.
>>>>> 
>>>>> jw
>>>>> 
>>>>>> Am 13.01.2019 um 12:44 schrieb Ricardo Parada <rpar...@mac.com>:
>>>>>> 
>>>>>> Hi all,
>>>>>> 
>>>>>> I have an entity A with a to-one relationship to entity B. 
>>>>>> 
>>>>>> The relationship is setup in eomodeler to propagate it’s primary key 
>>>>>> from A to B. 
>>>>>> 
>>>>>> I then create A and B, insert into editing context and set the to-one 
>>>>>> relationship in A to point to B. When I save changes EOF is trying to 
>>>>>> insert TWO instances of B. The second instance of B has NULL in all its 
>>>>>> properties:
>>>>>> 
>>>>>> INSERT INTO HOSTING_COMPANY(CUSTOMER_ID, name) VALUES (?, ?)" 
>>>>>> withBindings: 1:20462(customerID), 2:"test"(name)>
>>>>>> 
>>>>>> INSERT INTO HOSTING_COMPANY(CUSTOMER_ID, name) VALUES (NULL, NULL)
>>>>>> 
>>>>>> 
>>>>>> Is this a know bug? I am using a very old version of Wonder. 
>>>>>> 
>>>>>> The relationship is also set up to own the destination and Cascade on 
>>>>>> Delete. 
>>>>>> 
>>>>>> Thanks in advance for any help. 
>>>>>> 
>>>>>> Ricardo
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>> https://lists.apple.com/mailman/options/webobjects-dev/johann.werner%40posteo.de
>>>>>> 
>>>>>> This email sent to johann.wer...@posteo.de
>>>>> 
>>>> 
>>> 
>> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/aaron%40chatnbike.com
> 
> This email sent to aa...@chatnbike.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to