Skip Headers

# Example Mapping

Previous

Next

Although TopLink supports more complex mappings, most TopLink classes map to a single database table or XML element that defines the type of information available in the class. Each object instance of a given class maps to a single row comprising the object's attributes, plus an identifier (the primary key) that uniquely identifies the object.

Figure: How Classes and Objects Map to a Database Table illustrates the simplest database mapping case in which:

- Table_X in the database represents Class_X.

- Object_X1 and Object_X2 are instances of Class_X.

- Individual rows in Table_X represent Object_X1 and Object_X2, as well as any other instances of Class_X.

How Classes and Objects Map to a Database Table

Description of "How Classes and Objects Map to a Database Table"

TopLink provides you with the tools to build these mappings, from the simple mappings illustrated in Figure: How Classes and Objects Map to a Database Table, to complex mappings.

For an additional example of a relational mapping, see Figure: Direct-to-Field Mapping.

For an example of a nonrelational mapping, see Figure: XML Transformation Mappings.