Dependent Role of referential constraint errors
Posted: Thu 09 Feb 2012 03:05
Using a simple PK-FK relationship to generate a model using Entity Developer 4.2.120, I get the following error messages.
1 The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'source_setup_id' on entity 'FkbugModel.Store.setup_item_code' does not match the type of property 'id_item_coding' on entity 'FkbugModel.Store.setup_item' in the referential constraint 'fk_child_to_parent'. PriceBook.edml
2 The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'item_state_name' on entity 'FkbugModel.Store.setup_item_code' does not match the type of property 'pack_size' on entity 'FkbugModel.Store.setup_item' in the referential constraint 'fk_child_to_parent'. PriceBook.edml
3 The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'SourceSetupId' on entity 'FkbugModel.SetupItemCode' does not match the type of property 'IdItemCoding' on entity 'FkbugModel.SetupItem' in the referential constraint 'SetupItem_SetupItemCode'. PriceBook.edml
4 The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'ItemStateName' on entity 'FkbugModel.SetupItemCode' does not match the type of property 'PackSize' on entity 'FkbugModel.SetupItem' in the referential constraint 'SetupItem_SetupItemCode'. PriceBook.edml
Script used to generate the database.
CREATE TABLE setup_item (
setup_id integer NOT NULL,
source_setup_id integer NOT NULL,
id_item_coding character varying(30) NOT NULL,
pack_size integer NOT NULL,
item_state_name character varying(50) NOT NULL
);
ALTER TABLE public.setup_item OWNER TO postgres;
CREATE TABLE setup_item_code (
setup_id integer NOT NULL,
source_setup_id integer NOT NULL,
id_item_coding character varying(30) NOT NULL,
pack_size integer NOT NULL,
item_state_name character varying(50) NOT NULL
);
ALTER TABLE public.setup_item_code OWNER TO postgres;
ALTER TABLE ONLY setup_item
ADD CONSTRAINT pk_setup_item PRIMARY KEY (setup_id, source_setup_id, id_item_coding, pack_size, item_state_name);
ALTER TABLE ONLY setup_item_code
ADD CONSTRAINT pk_setup_item_code PRIMARY KEY (setup_id, source_setup_id, id_item_coding, pack_size, item_state_name);
ALTER TABLE ONLY setup_item_code
ADD CONSTRAINT fk_child_to_parent FOREIGN KEY (setup_id, source_setup_id, id_item_coding, pack_size, item_state_name) REFERENCES setup_item(setup_id, source_setup_id, id_item_coding, pack_size, item_state_name);
Thanks,
Charlie J.
1 The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'source_setup_id' on entity 'FkbugModel.Store.setup_item_code' does not match the type of property 'id_item_coding' on entity 'FkbugModel.Store.setup_item' in the referential constraint 'fk_child_to_parent'. PriceBook.edml
2 The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'item_state_name' on entity 'FkbugModel.Store.setup_item_code' does not match the type of property 'pack_size' on entity 'FkbugModel.Store.setup_item' in the referential constraint 'fk_child_to_parent'. PriceBook.edml
3 The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'SourceSetupId' on entity 'FkbugModel.SetupItemCode' does not match the type of property 'IdItemCoding' on entity 'FkbugModel.SetupItem' in the referential constraint 'SetupItem_SetupItemCode'. PriceBook.edml
4 The types of all properties in the Dependent Role of a referential constraint must be the same as the corresponding property types in the Principal Role. The type of property 'ItemStateName' on entity 'FkbugModel.SetupItemCode' does not match the type of property 'PackSize' on entity 'FkbugModel.SetupItem' in the referential constraint 'SetupItem_SetupItemCode'. PriceBook.edml
Script used to generate the database.
CREATE TABLE setup_item (
setup_id integer NOT NULL,
source_setup_id integer NOT NULL,
id_item_coding character varying(30) NOT NULL,
pack_size integer NOT NULL,
item_state_name character varying(50) NOT NULL
);
ALTER TABLE public.setup_item OWNER TO postgres;
CREATE TABLE setup_item_code (
setup_id integer NOT NULL,
source_setup_id integer NOT NULL,
id_item_coding character varying(30) NOT NULL,
pack_size integer NOT NULL,
item_state_name character varying(50) NOT NULL
);
ALTER TABLE public.setup_item_code OWNER TO postgres;
ALTER TABLE ONLY setup_item
ADD CONSTRAINT pk_setup_item PRIMARY KEY (setup_id, source_setup_id, id_item_coding, pack_size, item_state_name);
ALTER TABLE ONLY setup_item_code
ADD CONSTRAINT pk_setup_item_code PRIMARY KEY (setup_id, source_setup_id, id_item_coding, pack_size, item_state_name);
ALTER TABLE ONLY setup_item_code
ADD CONSTRAINT fk_child_to_parent FOREIGN KEY (setup_id, source_setup_id, id_item_coding, pack_size, item_state_name) REFERENCES setup_item(setup_id, source_setup_id, id_item_coding, pack_size, item_state_name);
Thanks,
Charlie J.