Bottom-Up: Mapping Tables to Classes

PowerDesigner provides default transformation rules for generating object-oriented models from physical data models. You can enhance the generated mappings manually using the Mapping Editor.

When you generate an object-oriented model from a data model:

  • Each selected table is transformed into a persistent entity class and its:
    • Columns are transformed into persistent attributes.
    • Keys are transformed into identifiers.
    • Primary keys are transformed into primary identifiers.
  • Reference keys have, by default, a cardinality of 0..* and will be transformed into into bidirectional many-to-many associations. To generate a one-to-one association, you need to set the maximum cardinality to 1 (cardinality 0..1 or 1..1). If the reference key is mandatory, the minimal multiplicity of one side of the generated association will be 1.

    You cannot generate inheritance links from reference keys and tables.

  1. Create your PDM (perhaps by reverse-engineering a database) and populate it with the appropriate tables and references.
  2. Select Tools > Generate Object-Oriented Model to open the OOM Generation Options dialog.
  3. On the General tab, specify the Object language type and the name and code of the OOM to generate (or select an existing OOM to update).
  4. Click the Detail tab and select the Generate Mappings checkbox. You can optionally also specify a class prefix that will be applied to all generated classes.

    orm25.gif
  5. Click the Selection tab and the select the tables that you want to transform into classes.
  6. Click OK to generate (or update) your OOM.