MultiTableInfo Foreign Key Mapping Leads to ORA-02291: integrity constraint violated - parent key not found
(Doc ID 554601.1)
Last updated on MARCH 24, 2019
Applies to:Oracle TopLink - Version 10.1.3.3 and later
Information in this document applies to any platform.
***Checked for relevance on 15-Feb-2012***
***Checked for relevance on 27-Oct-2013***
Two tables are mapped with a one-to-many relationship (Master-Detail), using a MultiTableInfo descriptor.
With the given foreign key mappings, insertion into the tables using Toplink 10.1.3.3 fails with the following message:
However, when doing the same insertion with Toplink 9.0.4 API it works fine.
Here is an example structure of two such tables :
Emp_id NUMBER(22) NOT NULL,
Name VARCHAR2(50) NOT NULL,
PRC_Projects_ID NUMBER(22) NOT NULL
CREATE TABLE Projects (
Pro_id NUMBER(22) NOT NULL,
CREATE SEQUENCE SN_PRO INCREMENT BY 1 START WITH 1;
ALTER TABLE Employee ADD CONSTRAINT PK_Employee PRIMARY KEY (Emp_id) USING INDEX;
ALTER TABLE Projects ADD CONSTRAINT PK_Projects PRIMARY KEY (Pro_id) USING INDEX;
ALTER TABLE Employee ADD CONSTRAINT FK_Projects FOREIGN KEY (PRC_Projects_ID) REFERENCES Projects (Pro_id);
To view full details, sign in with your My Oracle Support account.
Don't have a My Oracle Support account? Click to get started!
In this Document
|Workaround # 1:|
|Workaround # 2:|