Chapter 11 Linking and Synchronizing Models


Model Generation Options window Detail tab

The following options are available on this tab:

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. For more information, see "Checking a Model" in the Models chapter.
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.
Generate Mappings Defines the source model as the data source of the generated model and creates mappings between all source and target objects. This option is dependent on the Save Generation Dependencies option.
Rebuild Triggers [CDM-PDM and OOM-PDM generation only] Instructs PowerDesigner to build triggers with preservation option, after the PDM generation. Rebuild takes place after merge if you are updating an existing PDM
Convert Names into Codes Specifies that target model object codes are generated from source model object names using the appropriate conversion script. This can be useful when generating models with very different naming conventions. Otherwise, target codes are generated from source codes.

For example an OOM Java class attribute code may be "customerName" whereas a PDM table column may be "CUSTOMER_NAME". With this option selected, both objects will have their codes generated from their names.
Enable transformations Enables pre- and post-generation transformations.

When you click this button, the Pre-generation tab is displayed if the source model contains transformations. You can select the transformations to execute before generation.

The Extended Model Definitions tab also is displayed for you to select extended model definition files to attach to the generated model. These files may contain post-generation transformations, in this case, the Post-Generation tab is displayed to let you select the transformations you want to be executed in the generated model. If the generation is an update, and the generated model contains extended model definitions with post-generation transformations, the Post-generation tab automatically is displayed as soon as you click the Enable Transformations button
Generate columns/attributes as elements When selected, columns in the PDM tables are generated as child elements (instead of attributes) in the XML model. You can then set attributes to these child elements
Class Prefix Prefix for a class. It can help identify a class in a model

Table options

The following options are available during CDM-PDM and OOM-PDM generation:

Option Description
Table Prefix Specifies a prefix for the names of generated tables.

Reference options

The following options are available during CDM-PDM and OOM-PDM generation:

Option Description
Update Rule Specifies the default update constraint for referential integrity.
Delete Rule Specifies the default delete constraint for referential integrity.
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 "PDM Variables" in the DBMS Resource File Reference chapter of the Customizing and Extending PowerDesigner manual
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

Index options

The following options are available during CDM-PDM and OOM-PDM generation:

Option Description
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% - Table name
  • %TCODE% - Table code
  • %TLABL% - Table comment


Default: %TABLE%_PK
Key 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% - Reference name
  • %REFRCODE%- Reference code
  • %PARENT% - Generated code of the parent table
  • %PNAME% - Parent table name
  • %PCODE% - Parent table code
  • %CHILD% - Generated code of the child
  • %CNAME% - Child table name
  • %CCODE% - Child table 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
FK index names Specifies the naming convention for foreign keys, by default %REFR%_FK
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.

Note   Preserving a modified primary key
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.

Add package hierarchy

When you reverse engineer a database into a PDM and then generate an OOM with the corresponding O/R mapping, you can use the Add Package Hierarchy feature to create the appropriate packages in the OOM. You select the Add Package Hierarchy command from the object model contextual menu. For more information see chapter Generating for a language in the Object-Oriented Modeling guide.

For more information on conversion scripts, see the Models chapter.

 


Copyright (C) 2008. Sybase Inc. All rights reserved.