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 Object Type Mapping

In TopLink, you can match a fixed number of database values to Java objects through object type mappings. In the advanced tutorial, each employee's gender is stored as a single letter in the database field (M or F), but the value is the full name (Male or Female).

To map the gender attribute:

  1. Expand on the Employee descriptor in the Navigator pane.

  2. Object type mapping button.
    Description of the illustration obmapbtn.gif

    Select the gender attribute and click the Object-Type Mapping button in the mapping toolbar.

    Figure B-37 Object-Type Mapping Tab

    Description of otmap.gif follows
    Description of the illustration otmap.gif

  3. In the Database Field, select the GENDER field from the EMPLOYEE table.

  4. Select String as the Database Type, and String as the Object Type.

  5. Click Add and create the following database mappings:

    Database Value Object Value
    F Female
    M Male

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

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