About Mapping Relationships

Some situations require that the columns mapped to for the "to"/"from" end of a relationship can be set to NULL.

If the relationship does not have an ID, and if the ID of the type that the "from" end maps to is equal to the "from" column in the relationship itself, then make sure that the column mapping to the "to" end of the relationship can be set to NULL.

Similarly, if the ID of the type that the "to" end of the relationship maps to is equal to the "to" column in the relationship, then the column mapping to the "from" end of the relationship needs to be able to be set to NULL.

As an example:

type ECO {
   id ECO(ECOID);
   next "max(ECOID)+1";
   name ECOID;
   description DESCRIP;
   default policy "ECO Policy";
   default owner creator;
   }

   type PART {
   id REV(ITEMNO,ITEMREV) mapped;
   name ITEMNO;
   revision ITEMREV;
   default policy "LilyPart Policy";
   default owner creator;
   }

    	 relationship "New Part" {
      from ECO in REV(ECO);
      to PART in REV(ITEMNO,ITEMREV);
      }

In this example:

  • The ID for type ECO is the column ECOID in table ECO and the relationship is looking for that value in column ECO of table REV.
  • The ID for type PART is the column ITEMID, ITEMREV in table REV and the relationship is looking for that value in columns ITEMNO, ITEMREV of table REV.
  • In this case the column ECO in REV should be a column that can hold NULL values.

In cases when the relationship has an ID, the user needs to make sure that the columns that the "from"/"to" end map to (in this case PARENT, CHILD) can hold NULL values.