Re: Multiple foreign keys pointing to the same table
Re: Multiple foreign keys pointing to the same table
- Subject: Re: Multiple foreign keys pointing to the same table
- From: Pavan Kumar Jayam <email@hidden>
- Date: Mon, 14 May 2012 17:06:35 +0530
Thanks for the update Mr. Mark.
I will go through it.
Regards,
Pavan.
On 14-May-2012, at 5:01 PM, Mark Gowdy wrote:
> Read the replies to this posting. It should help.
>
> http://markmail.org/message/ndp7jgdfjwfnouwa#query:webobject many to many tutorial+page:1+mid:ejbgzqebozximrda+state:results
>
>> EOModeler can do this automatically for you. 1)Click on the model so you can see the model in list mode. 2)Select the two entities you want to join (Command Click on Mac Control Click on Windows) 3)Menu->Property->Join In Many-to-Many
>> Et VoilĂ !
>> Just fill the missing info in the newly created entity. Also I leave the correlation object to be of type EOGenericRecord (no need for create a custom class).
>>
>
> Mark
>
> Sent from my iPhone
>
> On 14 May 2012, at 12:00, Pavan Kumar Jayam <email@hidden> wrote:
>
>> Hi Ralf,
>>
>> Thanks for the suggestion and I will verify marking as deferrable constraint.
>>
>> And I followed another approach of storing the details in a join table, I am encountering a null pointer exception while saving the data. Displayed all the objects in the context by using "context.insertedObjects()" and I can see all the objects and data in console.
>>
>> Can you suggest me where I am going wrong.
>>
>> Regards,
>> Pavan.
>>
>>
>>
>> On 14-May-2012, at 3:44 PM, Ralf Schuchardt wrote:
>>
>>> Hi Pavan,
>>>
>>> the order of inserts of objects in a transaction is not specified. I think you see the insert of a row in table1 before the depending row in table2 causing the error.
>>> You should mark the foreign keys as "deferrable initially deferred" to postpone the integrity check to the end of the transaction, when all rows are inserted.
>>>
>>> Regards,
>>> Ralf
>>>
>>> Am 14.05.2012 um 10:57 schrieb Pavan Kumar Jayam:
>>>
>>>> Hi List,
>>>>
>>>> I want to have multiple foreign keys in Table1 representing same table Table2.
>>>>
>>>> Eg: Employee table have a Department table primary key as foreign key, now I want to have another foreign key in Employee table representing Department table. Which means an employee can be a member of two departments.
>>>>
>>>> I have foreign key in table1 represents table 2 primary key, also I want to have another foreign key in table 1 to represent the same table(table 2).
>>>>
>>>> Both the table 1 and table 2 records are creating in the same editing context and saving the editing context changes with ec.saveChanges().
>>>>
>>>> With one foreign key I am able to save table1 and table2 records, but when I am saving the editing context with multiple foreign keys of same table I am getting error "error code: 2291 == msg ORA-02291: integrity constraint() violated - parent key not found".
>>>>
>>>> Please advise how to implement it with Oracle 11 and WO 5.4.3.
>>>>
>>>> Regards,
>>>> Pavan.
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> 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
>
>
_______________________________________________
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