Defaulting Null Values

Direct mappings include a nullValue attribute. Use this attribute to convert database null values to application-specific values (if the application does not allow null values). This applies when typed as primitives. The null value must be set to the desired value, not the database value.

Null values translate in two directions: from null values read from the database to the specified value, and from the specified value back to null when writing or querying. You can also use TopLink to set global default null values on a per-class basis. For more information, refer to the book OracleAS TopLink Application Developer's Guide.

Click the Use Default Value when Database Field is Null option on the mapping's General tab (see Figure 5-2) and the Type and Value drop-down lists to specify the null value.


Note: You must specify the Type and Value in the mapping form.

Related Topics

About TopLink Descriptors

About TopLink Mapping Types
Working with Common Mapping Properties
Specifying Direct Access and Method Access
Specifying Read Only Settings
Maintaining Bidirectional Relationships
Specifying Field Names and Multiple Tables
Specifying Collection Properties
Specifying Mapping Information in ejb-jar.xml File
Working with Descriptors

 

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