Skip to Main Content

SQL Developer Data Modeler

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DM 4.2/932: identifying relationship - parent key is not part of the primary key on child table

jkoradbaMay 23 2017 — edited May 31 2017

Hi,

This is what I was expecting to see in my model:

"Identifying: Controls whether this is an identifying relationship. When there is an identifying relationship between a parent entity and a child entity, when the relational model is generated, the following occurs in the child table: the foreign key to the parent becomes part of the primary key of the child. (In non-identifying relationships, the foreign key to the parent table is just another column in the child table and is not part of the primary key.) "

However, this is not what gets generated. The parent key becomes a standalone unique key on the child table.

pastedImage_0.png

pastedImage_1.png

pastedImage_2.png

Generate DDL:

CREATE TABLE test_schema.test_child (

column\_b          VARCHAR2(255 CHAR),

test\_child\_sid    INTEGER

    GENERATED BY DEFAULT ON NULL AS IDENTITY ( START WITH 1 NOCACHE ORDER )

NOT NULL,

test\_parent\_sid   INTEGER NOT NULL

)

TABLESPACE users LOGGING;

ALTER TABLE test_schema.test_child ADD CONSTRAINT test_child_spk PRIMARY KEY ( test_child_sid );

ALTER TABLE test_schema.test_child ADD CONSTRAINT test_child_uk1 UNIQUE ( test_parent_sid );

CREATE TABLE test_schema.test_parent (

column\_a          VARCHAR2(255 CHAR),

test\_parent\_sid   INTEGER

    GENERATED BY DEFAULT ON NULL AS IDENTITY ( START WITH 1 NOCACHE ORDER )

NOT NULL

)

TABLESPACE users

logging;

ALTER TABLE test_schema.test_parent ADD CONSTRAINT test_parent_spk PRIMARY KEY ( test_parent_sid );

ALTER TABLE test_schema.test_child ADD CONSTRAINT test_relation_149_fk1 FOREIGN KEY ( test_parent_sid )

REFERENCES test\_schema.test\_parent ( test\_parent\_sid )

NOT DEFERRABLE;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 28 2017
Added on May 23 2017
2 comments
331 views