Warnings about multiple sources of truth for foreign keys on the same column

Posts   
 
    
WilliamB
User
Posts: 17
Joined: 10-Feb-2022
# Posted on: 27-Sep-2022 18:40:38   

Hello,

I just created the relational model on an LBLGEN project file using version 5.8 by syncing from an Oracle database and everything went well but there are some warnings that I am not sure how to treat them.

Here follows an example of one of them.

The Foreign Key field 'EmployerAccountId (FK)' in the relationship 'UiAddrLnk.UiEmployer - UiEmployer.UiAddrLnk (m:1)' is shared with the relationship 'UiAddrLnk.UiEmprUnit - UiEmprUnit.UiAddrLnk (m:1)', and therefore, has multiple sources of truth. You should re-model this so FK fields aren't shared among relationships.

I was wondering if anyone could explain in basic terms why this is happening and what possible solutions are available.

Thanks in advance.

Walaa avatar
Walaa
Support Team
Posts: 14855
Joined: 21-Aug-2005
# Posted on: 27-Sep-2022 23:36:58   

It seems that you have 2 relations using the same field (EmpAccountId) as a FK. So it might point to UiEmployer and it might point to UiAddrLnk.

These are the multiple sources of truth for the FK (the PK in EmpAccountId and the PK in UiEmployer), and this should be avoided.