Show TOC Start of Content Area

Object documentation Mapping Relationship Fields with Generic Types  Locate the document in its SAP Library structure

Definition

Relationship fields with generic types are:

·        Fields with object type, fields with interface type, or fields with persistence- or non-persistence capable class type

·        Fields with collection interface types like java.util.Set, java.util.Collection, java.util.List or java.util.Map that contain elements of object type, interface type, persistent or non-persistent capable class type (the element type is specified in the persistent metadata).

Use

If the referred value is an instance of a persistence capable class, then the object identifier (OID) is stored as a string in the so-called reference column. The runtime type of the referred persistence capable instance is stored in the discriminator column. The reference column together with the discriminator column are called a generic persistent reference.

Since the type of the referred instance is not known statically, it is not possible to store the OID fields in foreign key columns.

If the referred value is not an instance of a persistence capable class, then the value is serialized and stored in the serialized data column (see JDO Mapping Metadata DTD). A null value is stored in the discriminator column and in the reference column in this case. The information about the type of the instance is contained in the serialized data column.

Generic relationship are not bidirectional. Relationships, for example, cannot be established between two interfaces. Thus, a generic relationship always refers from a particular persistence capable class (which might implement an interface) to a generic type.

The possible scenarios are:

·        Many-to-one unidirectional generic relationships

·        One-to-one unidirectional generic relationships

·        Many-to-many unidirectional generic relationships

·        One-to-many unidirectional generic relationships

 

 

End of Content Area