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, TopLink supports NCHAR, NAVRCHAR2, and NCLOB database types. Use the Ncharacter, NString, and NClob target types, respectively.

Example 5-6 Type Conversion Mapping Example

Figure 5-11 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-11 Type Conversion Mappings

This figure shows a type conversion mapping between a Java class and a relational database.


Related Topics

About TopLink Mapping Types
Working with Direct Mappings

 

Creating Type Conversion Mappings for Java Objects
Creating Type Conversion Mappings for CMP EJBs

 

Copyright © 1997, 2004, Oracle. All rights reserved.