Object Mappings Properties

Click the Properties button to the right of the Mapping field on the Mapping tab of an object property sheet or in the Mappings pane of the Mapping Editor to open the mapping property sheet. The tabs available for a particular mapping depend on the objects being mapped.

The General tab contains the following properties:

Property

Description

Data Source

Name of the data source where data is extracted.

Target

Name of the target object that owns the mapping.

Parent

[Sub-object only] Specifies the name of the parent object.

Name

Specifies the name of the mapping.

Code

Specifies the technical name of the mapping.

Comment

Descriptive comment for the mapping.

Mapped to

Specifies the mapping expression. You can edit the expression directly in this field or click, the Edit tool to open it in a dedicated editor (see Modifying the Default Mapping Syntax). To recover the default expression click to release the User-Defined button.

The following tabs are also available:
  • Sources - Lists the source objects mapped to the object. Use the Add Sources tool to add additional source objects to the list.

  • Sub-Object Mappings - Lists the sub-objects of the mapped object that are mapped with sub-objects of the object.

    Tool

    Description

    Add Mapping - Select additional source sub-objects to map. After adding sub-objects, select the sub-objects to map them against in the Mapped to column.

    Create from Sources - Copy sub-objects from the source object to the object. The name, code , description, annotation, and comment are copied and the data types are converted in order to match the current model.

    Generate Mapping - Automatically generate mappings between sub-objects with the same name or code in the source and target models.

    Click the Ellipsis button in the Mapped to column to edit the source expression for the sub-objects.

  • Operation Mappings - [OOM classes only] Lists the operations and queries associated with the mapping Allows you to associate a SQL query to the operation. When an operation implies action on the database, like data retrieval or data update, you can associate this operation with a SQL query that will execute an action in the database. Usually, this query is a SELECT statement used to retrieve one or several instances of the current class according to the operation parameter. It can also be an UPDATE query. In the context of an EJB, the SQL query mapped to an operation is used to implement finder or select methods.

  • Criteria - Allows you to specify join criteria between source objects. For example: EMPLOYEE.ID < 100

  • Query - Computes a SQL query from the information in the other tabs to retrieve or update data in the database. If you modify the SQL query, it can no longer be automatically calculated, even when you update the mapping. You can recover the computed expression by clicking to release the User-Defined tool.

    A Select query is available for a forward mapping, and Insert, Update and Delete queries for a reverse mapping:
    • The Select tab retrieves attribute values of class instances from the database using the class identifying attributes. For example:
      select
        USER.USERNAME "USERNAME",
        USER.PASSWORD "PASSWORD"
      from  USER
    • The Insert tab creates an instance of the class and saves it with its attributes. For example:
      insert into USER(
         USER.USERNAME,
         USER.PASSWORD)
      values (
         %USERNAME%,
         %PASSWORD%)
    • The Update tab displays a statement that allows you to update attribute values of class instances apart from identifying attributes. For example:
      update USER
      set USER.USERNAME = %USERNAME%,
        USER.PASSWORD = %PASSWORD%
    • The Delete tab displays a statement that allows to delete a class instance from the database using its identifying attributes. For example:
      delete line* from USER

    To modify the default syntax of the queries, edit the SelectStatement, InsertStatement, UpdateStatement, and DeleteStatement entries in the Profile category of the object language or extension (see Customizing and Extending PowerDesigner > Extension Files).