Anton,
I have four tables:
SUBSCRIBER_278
REQUESTER_278
SPROVIDER_278
SERVICES_278
They are related as follows:
SUBSCRIBER_278 PK => UNIQUE_ID
REQUESTER_278 PK => HL_REQ_ID_NO, FK =>SUBSCRIBER_278.UNIQUE_ID
SPROVIDER_278 PK => HL_SPROV_ID_NO, FK =>SUBSCRIBER_278.UNIQUE_ID
SERVICES_278 PK => HL_SERV_ID_NO, FK =>SPROVIDER_278.UNIQUE_ID,SPROVIDER_278.HL_SPROV_ID_NO
The table definitions have been imported into the Schema Modeler and the Primary Keys have been set up as LargeAutoInc using Oracle Sequence Generators.
I am using Remote Data Adapter to Update the tables.
I am establishing the row level relationships between the tables as follows:
var subscriberRow = svcCWAuth.SUBSCRIBER_278.NewSUBSCRIBER_278Row();
subscriberRow.FillSubscriberRow(patientDBRecord.Subscriber);
svcCWAuth.SUBSCRIBER_278.AddSUBSCRIBER_278Row(subscriberRow);
var requesterRow = svcCWAuth.REQUESTER_278.NewREQUESTER_278Row();
requesterRow.FillRequesterRow(patientDBRecord.Requester);
requesterRow.UNIQUE_ID = subscriberRow.UNIQUE_ID;
svcCWAuth.REQUESTER_278.AddREQUESTER_278Row(requesterRow);
var sproviderRow = svcCWAuth.SPROVIDER_278.NewSPROVIDER_278Row();
sproviderRow.FillProviderRow(patientDBRecord.SProvider);
sproviderRow.UNIQUE_ID = subscriberRow.UNIQUE_ID;
svcCWAuth.SPROVIDER_278.AddSPROVIDER_278Row(sproviderRow);
var servicesRow = svcCWAuth.SERVICES_278.NewSERVICES_278Row();
servicesRow.FillServicesRow(patientDBRecord.Service);
servicesRow.UNIQUE_ID = sproviderRow.UNIQUE_ID;
servicesRow.HL_SPROV_ID_NO = sproviderRow.HL_SPROV_ID_NO;
svcCWAuth.SERVICES_278.AddSERVICES_278Row(servicesRow);
Without Relations declared in the Schema Modeler, I get the following exception (on the server) when trying to perform a table update:
ORA-02291: integrity constraint (CWEB.FK_REQUESTER_1) violated - parent key not found
When I define the relation: SUBSCRIBER_278.UNIQUE_ID => REQUESTER_278.UNIQUE_ID and try to update the table, I get the next exception:
ORA-02291: integrity constraint (CWEB.FK_SPROVIDER_1) violated - parent key not found
Likewise, when I define the relation: SUBSCRIBER_278.UNIQUE_ID => SPROVIDER_278.UNIQUE_ID and try to update the table, I get the next exception:
ORA-02291: integrity constraint (CWEB.FK_SERVICES_12) violated - parent key not found
So, when I set up the relation: SPROVIDER_278.UNIQUE_ID,HL_SPROV_ID_NO => SERVICES_278.UNIQUE_ID,HL_SPROV_ID_NO, I still get the following exception:
ORA-02291: integrity constraint (CWEB.FK_SERVICES_12) violated - parent key not found
I am unsure if we are defining the relations properly (I have tried to define them as two separate relation and had the same end result), or if there is something else going on.
Thanks,
Mark