Skip Headers

# Configuring a Default Null Value at the Mapping Level

Previous

Next

A default null value is the Java `Object` type and value that TopLink uses instead of `null` when TopLink reads a null value from a data source.

When you configure a default null value at the mapping level, TopLink uses it to translate in two directions:

- When TopLink reads `null` from the data source, it converts this `null` to the specified type and value.

- When TopLink writes or queries to the data source, it converts the specified type and value back to `null`.

Table: Mapping Support for Default Null Values summarizes which mappings support this option.

Mapping Support for Default Null Values

Mapping | Using TopLink Workbench | Using Java
--- | --- | ---
Relational Mappings |  |
Direct-to-Field Mapping |  |
Direct-to-XMLType Mapping |  |
EIS Mappings |  |
EIS Direct Mapping |  |
XML Mappings |  |
XML Direct Mapping |  |
XML Composite Direct Collection Mapping |  |

Note: A default null value must be an `Object`. To specify a primitive value (such as `int`), you must use the corresponding `Object` wrapper (such as `Integer`).

You can also use TopLink to set a default null value for all mappings used in a session (see "Configuring a Default Null Value at the Login Level").