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
 

Working with Type Conversion Mappings

Type conversion mappings explicitly map a database type to a Java type. For example, a Number in the database can be mapped to a String in Java, or a java.util.Date in Java can be mapped to a java.sql.Date in the database.

For Oracle9 databases, OracleAS TopLink supports NCHAR, NAVRCHAR2, and NCLOB database types. Use the Ncharacter, NString, and NClob target types, respectively.

Example 5-2 Type Conversion Mapping Example

Figure 5-3 illustrates a type conversion mapping. Because the java.util.Date class is stored by default as a Timestamp in the database, it must first be converted to an explicit database type such as java.sql.Date (required only for DB2— most other databases have a single date data-type that can store any date or time).

Figure 5-3 Type Conversion Mappings

Description of tcmapfig.gif follows
Description of the illustration tcmapfig.gif

Creating Type Conversion Mappings

Use this procedure to create a type conversion mapping.

To create a type conversion mapping:

  1. Select the attribute to be mapped from the Navigator pane.

  2. Type Conversion Mapping button.
    Description of the illustration tcmapbtn.gif

    Click the Type Conversion Mapping button on the mapping toolbar.

  3. From the Database field and Database type drop-down lists on the General tab in the Editor pane, choose the appropriate database field and database type.

Figure 5-4 Type Conversion Mapping Properties

Description of tcmaptab.gif follows
Description of the illustration tcmaptab.gif

You can also specify:

  • Read-only attributes – See "Specifying Read-Only Settings" on page 4-72

  • Access methods – See "Specifying Direct Access and Method Access" on page 4-71