When an entity object is created from an existing table in the database in the ADF, the following occurs:
1,
The property name conversion is completed. For example, Java will convert the property names such as manager_id in the database to managerid, that is, the conversion is based on the corresponding rules, most of which are to remove the underline ("_")
2,
Converts the Data Types of each column in SQL and Java. It is worth noting that varchar is converted to string.
3,
Converts or maps the length and precision of each attribute in the database.
4,
Converts or maps the primary key and uniqueness.
5,
Converts or maps mandatory attributes and other constraints.
6,
Converts or maps relations between entities based on foreign key relationships.
(In the ADF, XML is used to record the correspondence between the object and the data object in the database)
Supplement:
(1)
If the table has a primary foreign key relationship, the relationship is generated under the entities package at the same time as the entity is generated. A special package is created under the entity package to place the relationship.
(2)
Because an object contains at least one attribute as its primary key, if the data object in the database does not have a primary key, when it is mapped to an object, it cannot be inferred which attribute should be the primary key. In this case, jdeveloper automatically creates a column named rowid to correspond to the rowid in the data table and uses this attribute as the primary key of the object. You can manually modify the rowid attribute later, delete the rowid attribute, and set other attributes as the primary key.