Skip Headers
Oracle® Application Server TopLink Mapping Workbench User's Guide
10g Release 2 (10.1.2)
Part No. B15900-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Implementing a Transformation Mapping

Use transformation mappings for specialized translations between how a value is represented in Java and in the database. The method takes a database row as an argument and is called whenever an object is written to the database. The method returns the value from the object that should be written to the field.

In the advanced tutorial, the transformation method corresponds to a single argument method on the Employee class and extracts the values from the fields, placing them into the NormalHours array.

To map the normalHours attribute:

  1. Expand the Employee descriptor in the Navigator pane.

  2. Click the normalHours attribute of the Employee descriptor.

  3. Transformation Mapping button.
    Description of the illustration trmapbtn.gif

    Click the Transformation Mapping button on the mapping toolbar.

  4. Use the Database Row -> Object Method drop-down list to select the bulidNormalHours method.

  5. Click the Add button to create the following Object->Field Methods:

    • Database Field: START_TIME, Method: getStartTime

    • Database Field: END_TIME, Method: getEndTime

    Figure B-43 Transformation Mapping Tab

    Description of trmapdbr.gif follows
    Description of the illustration trmapdbr.gif

  6. Save button.
    Description of the illustration savebtn.gif

    Click Save on the toolbar or choose File >  Save Project to save the project.