Prev Next

DDL Transformation

The DDL transformation converts the logical model to a data model structured to conform to one of the supported DBMSs. The target database type is determined by which DBMS is set as the default database in the model. The data model can then be used to automatically generate DDL statements to run in one of the system-supported database products.

The DDL transformation uses and demonstrates support in the intermediary language for a number of database-specific concepts.

Concepts

Concept

Effect

See also

Table

Mapped one-to-one onto Class elements.

'Many-to-many' relationships are supported by the transformation, creating Join tables.

Column

Mapped one-to-one onto attributes.

Primary Key

Lists all the columns involved so that they exist in the Class, and creates a Primary Key Method for them.

Foreign Key

A special sort of connector, in which the Source and Target sections list all of the columns involved so that:

  • The columns exist
  • A matching Primary Key exists in the destination Class, and
  • The transformation creates the appropriate Foreign Key
Transform Foreign Keys

MDG Technology to customize default mappings

DDL transformations that target a new, user defined DBMS require an MDG Technology to map the PIM data types to the new target DBMS. 

To do this, create an MDG Technology .xml file named 'UserDBMS Types.xml', replacing UserDBMS with the name of the added DBMS. Place the file in the EA\MDGTechnologies folder.  The contents of the MDG Technology file should have this structure:

<MDG.Technology version="1.0">

     <Documentation id="UserdataTypes" name="Userdata Types" version="1.0" notes="DB Type mapping for UserDBMS"/>

     <CodeModules>

          <CodeModule language="Userdata" notes="">

               <CodeOptions>

                    <CodeOption name="DBTypeMapping-bigint">BIGINT</CodeOption>

                    <CodeOption name="DBTypeMapping-blob">BLOB</CodeOption>

                    <CodeOption name="DBTypeMapping-boolean">TINYINT</CodeOption>

                    <CodeOption name="DBTypeMapping-text">CLOB</CodeOption>

                     ...

               </CodeOptions>

          </CodeModule>

     </CodeModules>

</MDG.Technology>

As an example, 'text' is a Common Type (as listed in the 'Database Datatypes' dialog) that maps to a new DBMS's 'CLOB' data type.

Notes

  • You can define DBMS-specific aspects not depicted in a Logical model, such as Stored Procedures, Triggers, Views and Check Constraints, after the transformation; see the Physical Data Model topic

Example

The PIM elements

Platform Independent Model (PIM) in Sparx Systems Enterprise Architect.

After transformation, become the PSM elements

DDL Platform Specific Model (PSM) in Sparx Systems Enterprise Architect.

Generalizations are handled by providing the child element with a Foreign Key to the parent element, as shown. Copy-down inheritance is not supported.

UML Class diagram before and after DDL transformation in Sparx Systems Enterprise Architect.

Learn more