Oracle® Application Server TopLink Mapping Workbench User's Guide
10g Release 2 (10.1.2) Part No. B15900-01 |
|
Previous |
Next |
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:
Expand on the Employee
descriptor in the Navigator pane.
Description of the illustration obmapbtn.gif
Select the gender
attribute and click the Object-Type Mapping button in the mapping toolbar.
In the Database Field, select the GENDER field from the EMPLOYEE table.
Select String as the Database Type, and String as the Object Type.
Click Add and create the following database mappings:
Database Value | Object Value |
---|---|
F
|
Female
|
M
|
Male
|
Description of the illustration savebtn.gif
Click Save on the toolbar or choose File > Save Project to save the project.