Skip Headers

# Direct Map Mapping

Previous

Next

Direct map mappings store instances that implement `java.util.Map`. Unlike one-to-many or many-to-many mappings, the keys and values of the map in this type of mapping are Java objects that do not have descriptors. The object type stored in the key and the value of direct map are Java primitive wrapper types such as `String` objects.

Figure: Direct Map Mappings illustrates how a direct map is stored in a separate table with three fields. The first field (EMPID) is the reference key field, which contains a reference to the primary key of the instance owning the collection. The second field (ADDRESS) contains an object in the collection and is called the direct value field. The third field (TYPE) contains the direct key field. In this example, the direct map uses a object type converter for the direct key field, converting the single character W in the database to the full string Work in the object (and H to Home).

Direct Map Mappings

Description of "Direct Map Mappings "

You can use a direct collection mapping with any of the following `Converter` instances:

- see "Object Type Converter"

- see "Serialized Object Converter"

- see "Type Conversion Converter"

You can use a direct map mapping with a change policy (see "Configuring Change Policy").

See "Configuring a Relational Direct Map Mapping" for more information.