Transform Foreign Keys

ForeignKey is a special case where not just a connector is created - you must also list the columns involved in the transformation. In addition, tags specified on the connector are actually created on the foreign key operation in the source Class, and you can add a cascade property:
 
cascade="update","delete"

Example

This example is from the DDL transformation Connector template. For the template:

 

 ForeignKey

 {

   %TRANSFORM_REFERENCE("FK1",connectorGUID)%

   Source

   {

     %TRANSFORM_REFERENCE("LinkTable",connectorGUID)%

     name=%qt%%connectorDestElemName%%qt%

     Column

     {

         name=%qt%%CONVERT_NAME(connectorDestElemName, "Pascal Case","Camel Case")%ID%qt%

           type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%

     }

   }

   Target

   {

     %TRANSFORM_REFERENCE("Table",connectorDestElemGUID)%

     Column

     {

       name=%qt%%CONVERT_NAME(connectorDestElemName, "Pascal Case","Camel Case")%ID%qt%

       type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"Integer")%%qt%

     }

   }

 }

 

 

This code is generated for a Foreign Key:

 

 ForeignKey

 {

   XRef{namespace="DDL" name="FK1" source="{18ED24EA-0669-499c-A066-FABEE6772ED1}"}

   Source

   {

     XRef{namespace="DDL" name="Table" source="{CC6A084C-9B56-4a1e-8196-C66A74E59B66}"}

     name="FK_account"

     multiplicity="0..*"

     Column

     {

       name="account"

       type="INTEGER"

     }

   }

   Target

   {

     XRef{namespace="DDL" name="Table" source="{791AEAB5-7831-4d2a-92C7-198C10B31AF0}"}

     multiplicity="1"

     Column

     {

       name="accountID"

       type="INTEGER"

     }

   }

 }