Direct-to-field mappings map a Java attribute directly to a value database column. When the application writes a Java instance to the database, it stores the value of the attribute in a field of the table column. TopLink supports the following types:
While reading, direct-to-field mappings perform some simple one-data conversions, as described in Table 5-1. You must use other direct mappings for two-way or more complete conversions.
Table 5-1 Type Conversions Provided by Direct-to-Field Mappings
Direct-to-field mappings also allow you to specify a null value. This may be required if primitive types are used in the object, and the database field allows null values.
Example 5-5 Direct-to-Field Mapping Example
Figure 5-10 illustrates a direct-to-field mapping between the Java attribute city and the relational database column CITY. Similarly, direct-to-field mappings could be defined from country to COUNTRY, id to ADDRESS_ID, established to EST_DATE, and province to PROVINCE.
Figure 5-10 Direct-to-Field Mapping
Copyright © 1997, 2004, Oracle. All rights reserved.