Mappings are sub-objects of the target object on which they are defined. Mappings do not have diagram symbols or Browser entries, and are only accessible from the Mapping Editor or from the Mapping tab of their parent object property sheet.
To open a mapping property sheet, select the mapping from the list at the top of the
Mapping Editor Mappings pane or parent object property sheet
Mapping tab and click the
Properties tool.
The tabs available on a particular mapping property sheet depend on the objects being mapped. The General tab contains the following properties:
Property |
Description |
---|---|
Data Source |
Specifies the name of the data source in which the source object is defined. Click the Properties tool to open the property sheet of the data source. |
Target |
Specifies the name of the target object that owns the mapping. |
Parent |
[Sub-object mappings] Specifies the name of the parent of the target object. |
Name/Code/Comment |
Identify the mapping. The name should clearly convey the object's purpose to non-technical users, while the code, which is used for generating code or scripts, may be abbreviated, and should not normally include spaces. You can optionally add a comment to provide more detailed information about the mapping. By default the code is generated from the name by applying the naming conventions specified in the model options. To decouple name-code synchronization, click to release the = button to the right of the Code field. |
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 SQL or Object Expression editor. In the editor, select an object type from the list in the upper left corner, to display a list of available objects of that type in the upper right corner. Double-click an available object to add it at the insertion point in the expression displayed in the lower half of the editor. To undo your changes and recover the default expression click to release the User-Defined button. |
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. The following tools are available on this tab.
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.
select USER.USERNAME "USERNAME", USER.PASSWORD "PASSWORD" from USER
insert into USER( USER.USERNAME, USER.PASSWORD) values ( %USERNAME%, %PASSWORD%)
update USER set USER.USERNAME = %USERNAME%, USER.PASSWORD = %PASSWORD%
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).