Skip Headers
Oracle TopLink Developer's Guide
10g Release 3 (10.1.3)
B13593-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Direct Collection Mapping

Direct collection mappings store collections of Java objects that are not TopLink-enabled. The object type stored in the direct collection is typically a Java type, such as String.

It is also possible to use direct collection mappings to map a collection of non-String objects. For example, it is possible to have an attribute that contains a collection of Integer or Date instances. The instances stored in the collection can be any type supported by the database and has a corresponding wrapper class in Java.

Support for primitive data types such as int is not provided, because Java Vectors hold only objects.

Figure 36-6 illustrates how a direct collection is stored in a separate table with two fields. The first field is the reference key field, which contains a reference to the primary key of the instance owning the collection. The second field contains an object in the collection and is called the direct field. There is one record in the table for each object in the collection.

Figure 36-6 Direct Collection Mappings

Description of Figure 36-6  follows
Description of "Figure 36-6 Direct Collection Mappings "


Note:

The responsibilities attribute is of type Vector. When using JDK 1.2, it is possible to use a Collection interface (or any class that implements the Collection interface) for declaring the collection attribute. See "Configuring Container Policy"for details.

Maps are not supported for direct collection because there is no key value.

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

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

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