Code: Select all
CREATE TABLE "STUDENT"
( "ID" NUMBER NOT NULL ENABLE,
"NAME" VARCHAR2(20),
CONSTRAINT "STUDENT_PK" PRIMARY KEY ("ID") ENABLE
) TABLESPACE "DATA" ;
CREATE TABLE "STUDENT_GPA"
( "STUDENT_ID" NUMBER NOT NULL ENABLE,
"GPA" NUMBER NOT NULL ENABLE,
CONSTRAINT "STUDENT_GPA_PK" PRIMARY KEY ("STUDENT_ID") ENABLE
) TABLESPACE "DATA" ;
ALTER TABLE "STUDENT_GPA" ADD CONSTRAINT "STUDENT_GPA_STUDENT_FK1" FOREIGN KEY ("STUDENT_ID")
REFERENCES "STUDENT" ("ID") ENABLE;
The table Student has a primary key 'ID'. In the table Student_GPA , the Student_Id column is the primary key and it also references the ID in the student table.
When i try to generate the model ,
1. It sets the relationship between Student and Student_Gpa as 'one to many'. Shouldn't it be one to one ?
2. I tried to manually set this as 'one to one' and when i checked out the relationship , it was correctly displaying 'STUDENT' as the parent table and 'STUDENT_GPA' as the child table. But when i try to do my inserts , its trying to insert into the student_gpa first and this results in an exception as the 'STUDENT' record has not been inserted yet. Shouldn't it insert into the parent table first and then fire the inserts for the child tables ?
Please let me know if i am doing anything wrong or if these are known bugs ?