Interpretation of the Orm (2) of the JDO specification

xiaoxiao2021-03-06  21

This is a case where a class is mapped to multiple TABLE.

Class called Address:

The surface structure is as follows:

Create Table Addr

Street varchar (255) Primary Key,

City varchar (255),

State Char (2),

Zipcode Varchar (10)

)

Create Table Deliv

Addr_Street Varchar (255),

SIG_REQUIRED BIT,

Deliv_ins clob

)

Create Table Mapquest_info

Addr_Street Varchar (255),

Mapquest_image blob

)

The contents of the mapping file are as follows:

Interpretation:

Here, this element is used to map multiple tables to a Class, and we call the Class's Table as a primary table, and other tabs. Use two ways:

1. , this is set a shared join element, all Field defined by using table = "deliv" is mapped from Deliv, that is, this Class multiple Field Mapped to a sub-table. Such as: and

Column = "addr_street" indicates that the table deliv is associated with the primary table (that is, addr) through the addr_street.

2. A file map is mapped to a sub-table:

Similarly, the column = "addr_street" in the join element indicates that the primary table (that is, addr) is associated with the primary table (i.e., addr) by addr_street.

It should be noted that the associated column must be a primary key.

Using this file, we open a Class to map to multiple Tables.

转载请注明原文地址:https://www.9cbs.com/read-60825.html

New Post(0)