-
1. Re: Relation-table Mapping
dsundstrom Jul 24, 2002 1:08 AM (in response to bsreekanth)Remove the many to many relationship, and create a new bean with a one-many relationship with each of the other beans. Then add your new cmp fiels.
-
2. Re: Relation-table Mapping
bsreekanth Jul 24, 2002 11:45 AM (in response to bsreekanth)I tried with one to many . But the problem is
the foreign key in the intermediate mapping table is a primary key in the other table, which is not possible in 1-N relations.
Ex:
let's say we have two tables, Organization and Personnel. Organization's have organization_id as PK and Personnel has employee_id as PKs.
Iam trying to have a many-many relation between these two tables. So I introduced a mapping table org-pers with a primary key consists of both organization_id and personnel_id. This table has some more fields.
As organization_id (foreign key) in this org-pers table is a primary key of organization table , I can't have a 1-N relation between organization and org-pers tables. Similary org-pers and Personnel.
Am I looking the problem in a right way or you mean something else ?
thanks for ur help
sreek -
3. Re: Relation-table Mapping
bsreekanth Jul 24, 2002 11:55 AM (in response to bsreekanth)I tried and the problem is this:
The foreign key of the mapping table is a primary key in the other tablem which is not possible in 1-N relation.
Ex:
let's say we have two tables, Organization and Personnel.
Organization has organization_id as PK and Personnel has employee_id as PKs.
To have a many-many relation between these tables , I introduced a mapping table org-pers with
a primary key consists of both organization_id and perosonnel_id. This table also has some other fields.
Now Iam trying to create a 1-N between organization , org-pers and peronnel, org-pers.
As organization_id is a foreign key in org-pers and it's a primary key in organization, I can not get a 1-N relation betwen organization and org-pers.
Similarly personnel and org-pers.
Am I looking the problem in right war or you mean something else.
thanks for the help,
sreek