Interpretation of the ORM (3) of the JDO specification

xiaoxiao2021-03-06  42

Let's take a look at the relationship between MANY-One, how to map.

This is a class diagram: The Employee class has a reference pointing to the Department class.

Table Structure:

CREATE TABLE EMP

SSN Char (10) PRIMARY Key,

DEP_NAME VARCHAR (255)

)

Create Table DEP

Name varchar (255) Primary Key

)

Mapping file content:

Interpretation:

1. , the Employee class has a field called Department, which is an instance of the Department of the Department. Column = "dep_name" indicates that the table of Employee uses the name of the name to dep_name to associate with the DEPARTMENT table. This dep_name is the column name in the EMPLOYEE table, actually associated with the primary key NAME of the table of departments.

2. The map of the representment class can be written.

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

New Post(0)