Model Generation Options

You can customize the generation of your models by selecting model generation options.

General Tab

The General tab lets you specify the new model to be generated or existing model to be updated.When generating a new model, you must specify the following options:

Option

Description

DBMS, Object, XML, or Process language

Specifies the definition file for the model to be generated. By default, PowerDesigner creates a link to this file. To copy the definition and save it in your model file, click the Embed Resource in Model button.

Name / Code

Specifies the name and code for the model to be generated.

Click the Configure Model Options button to specify naming conventions (see Naming Conventions) and other model options for the model to be generated.

When updating an existing model, you must specify the following options:

Option

Description

Select model

Specifies the target model to be updated. Select a model that has already been generated from the current model from the list, or click the ellipsis button to the right to open a list of other models of the same type open in the workspace.

DBMS, Object, XML, or Process language

Displays the definition file of the model to be updated.

Preserve modifications

Allows you to review the changes to be made to the model (see Comparing and Merging Models). If this option is not selected, generated objects will replace objects with the same name in the model.

DBMS Preserve Options Tab

This tab is only available when you generate a PDM from another PDM, and allows you to choose to preserve, where possible, the values associated with:
  • Physical options - for relevant objects

  • Triggers and stored procedures – If the target belongs to a different DBMS family, triggers are automatically rebuilt.

  • Database objects – Only objects supported by the target DBMS will be generated.

  • Extended attributes

Detail Tab

The Detail tab contains options to control the generation of model objects.

Option

Description

Check Model

Invokes a model check before generation, and stops generation if errors are found. You can configure specific model checks before generation by selecting Tools > Check Model (see Checking Models).

Save Generation Dependencies

Instructs PowerDesigner to retain links between each source object and the corresponding target object, which allow objects to be subsequently identified, even if they have been modified (see The Generation Links Viewer).

Generate Mappings

Defines the source model as the data source of the generated model and creates mappings between all source and target objects (see Object Mappings). This option is dependent on the Save Generation Dependencies option.

Rebuild Triggers

[CDM/OOM-PDM] Instructs PowerDesigner to rebuild triggers with unmodified templates after the PDM generation.

Convert Names into Codes

Instructs PowerDesigner to generate target model object codes using a conversion script. This option can be useful when generating models with very different naming conventions. If it is not selected, target object codes are generated from source object codes.

For example, generate an OOM Java class attribute with a code of customerName to a PDM table column called CUSTOMER_NAME by clicking the Configure Model Options button on the General tab, selecting the appropriate conversion script (see Name and Code Conversion Scripts), and selecting this option.

Preserve n-n relationships

[CDM-LDM only] Specifies that many-to-many relationships created in the CDM will be generated to the LDM if the destination model permits them.

Enable transformations

Displays the Extensions tab, the Pre-generation tab (if your model has transformations defined) and the Post-generation tab (if you are updating an existing model that has transformations defined) to select transformations to perform before and/or after generation (see Applying Pre- and Post- Generation Transformations).

Skip single root element

[XSM-PDM only] Specifies that the single root element is ignored, and its immediate child elements are treated as multiple roots, which will be generated as tables.

Generate root element

[PDM/OOM-XSM only] Specifies that a single root element representing the PDM or OOM model is generated. Deselecting this option means that all the tables or classes are generated as multiple roots.

Generate tables/classes as

[PDM/OOM-XSM only] Specifies how PDM tables or OOM classes are generated. You can choose between:
  • Elements - [default] each table/class is generated as an untyped element directly linked to its columns/attributes generated as attributes or sub-elements.
  • Elements with complex types - each table/class is generated as an element typed by a complex type, generated in parallel, to contain the columns/attributes.
You can override this option for individual tables or classes (see Customizing XSM Generation for Individual Objects).

Generate columns/attributes as

[PDM/OOM-XSM only] Specifies how PDM columns or OOM attributes are generated. You can choose between:
  • Elements - [default] each column/attribute is generated as an sub-element of its table/class element or complex type.
  • Attributes - each column/attribute is generated as an attribute of its table/class element or complex type.
You can override this option for individual columns or attributes (see Customizing XSM Generation for Individual Objects).

Class Prefix

[OOM only] Specifies a prefix to apply to the codes for all classes generated.

PDM Generation Options

The following additional options are available when generating a PDM:

Option

Description

Table: Table Prefix

Specifies a prefix for the names of generated tables.

Table: ID column type

[XSM-PDM only] Specifies the type to use for ID columns, and which will be used to generate xs:ID types.

Default: numeric

Index: PK index names

Specifies the naming convention for primary keys. You can use the following variables in this and the Key index fields:
  • %TABLE% - Generated code of the table. This is the table code that is generated in the database. It may or may not be truncated if the code contains characters not supported by the DBMS

  • %TNAME%, %TCODE% - Table name and code

  • %TLABL% - Table comment

Default: %TABLE%_PK

Index: AK index names

Specifies the naming convention for alternate keys. You can use the following variables in this field:
  • %REFR% - Generated code of the reference

  • %REFNAME%, %REFRCODE% - Reference name and code

  • %PARENT% - Generated code of the parent table

  • %PNAME%, %PCODE% - Parent table name and code

  • %CHILD% - Generated code of the child

  • %CNAME%, %CCODE% - Child table name and code

  • %PQUALIFIER% - Parent table qualifier

  • %CQUALIFIER% - Child table qualifier

The generated code of a variable is the code defined in the object property sheet, which may be truncated when generated if the code contains characters not supported by the DBMS

Default: %TABLE%_AK

Index: FK index names

Specifies the naming convention for foreign keys, by default %REFR%_FK

Index: FK threshold

Specifies the minimum number of estimated occurrences of an entity necessary to create an index on a foreign key. The estimated number of occurrences can be specified in the entity property sheet. If this property is not set, foreign key indexes are generated by default.

Reference: Update Rule

Specifies the default update constraint for referential integrity.

Reference: Delete Rule

Specifies the default delete constraint for referential integrity.

Reference: FK column name template

Specifies the naming convention for migrated foreign keys. You can select one of the default templates from the list or enter your own using the following variables:
  • %REFR% - Name / Code of the reference

  • %PARENT% - Name / Code of the parent table

  • %COLUMN% - Name / Code of the parent column

  • %KEY% or %CONSTNAME% - Name / Code of the key constraint attached to the reference

  • %PROLE% - Role of the entity that generated the parent table, this variable proceeds from the conceptual environment. If no role is defined on the relationship or association, %PROLE% takes the content of %PARENT% to avoid generating a column with no name

The following example checks the %PROLE% value; if it is equal to the parent name (which is the replacement value) then the template "%.3:PARENT%_%COLUMN%" will be used, otherwise template "%PROLE%" will be used because the user has entered a parent role for the relationship:
[%PROLE%=%PARENT%?%.3:PARENT%_%COLUMN%:%PROLE%]
Customized naming templates reappear in the generation dialog box the next time you open it, but are not saved to the list of predefined templates.

For more information about PowerDesigner variables, see Customizing and Extending PowerDesigner > DBMS Definition Files.

Reference: Use template

Controls when the FK column name template will be used. You can choose between the following radio buttons:
  • Always use template

  • Only use template in case of conflict

Note: If you modify a primary key in a PDM, then regenerate the PDM from a CDM, the modified primary key is not preserved. If you want to preserve a modified primary key, you need to modify the identifier in the CDM before regeneration.

When you reverse engineer a database into a PDM and then generate an OOM, you can add an appropriate package hierarchy in the OOM by right-clicking the OOM in the Browser, selecting Add Package Hierarchy, and entering an appropriate hierarchy (for example, com.mycompany.myproduct.oom).

Target Models Tab

This tab contains a list of target models referenced by shortcuts or replications in the current model, and the appropriate generated models that the generated model will reference (see Generating Shortcuts and Replicas). If any target model does not have a generated model listed, the generation of shortcuts or replications referencing it will fail. This tab will be empty if your model does not contain shortcuts to other models or if these shortcuts are set to generate as independent objects.