First, hibernate reverse engineering generated entity
Introduces a model design tool, PowerDesigner, which is a necessary tool for the development of the Java EE. It is common to use PowerDesigner to create an entity diagram, a conceptual model, in development. A conceptual model is built to generate a physical model of a particular database type, and then a library table is created based on the creation table script of the physical model, and finally the entity classes and mapping files are generated against the table using the Hibernate attribute of MyEclipse. This eliminates the hassle of writing entities and mapping files and their entity relationships.
Ii. Conceptual model of design
Relationship general entity relationships can be used, and if the relationship between entities is specified as many-to-many, then a new relational table with 2 entity primary keys combined as a federated primary key will be generated automatically when PDM is generated
Inheritance the inheritance relationship between entities, such as: Employee-leadership
Association relationships, such as the existence of many-to-many relationships between roles and people, are called: personnel roles, which may also have a status of whether or not.
Association link for connecting entities and relationships
link/extended additional information about dependency entities or relationships, with independent information; No primary foreign key relationship
For example, design a person organization structure: There are institutions, departments, employees, leaders, roles, permissions.
A body has multiple departments
A department with multiple employees
Leaders can manage multiple departments while leading him and his staff
An employee can have multiple roles
A role can be assigned to more than one person
People role assignments can be set if they are valid, allocated time, etc.
A role has multiple permissions
After the conceptual model is transferred directly into the physical model, the transformed physical model can adjust the relevant information according to the actual situation of the project.
Iii. export of physical models
When you specify or repair a primary foreign key relationship in a physical model, you typically only need to develop a primary key generation strategy, and foreign key relationships are preserved from the conceptual model. If you are dissatisfied with its auto-generated foreign key relationship, you can modify it in the physical model. Any modifications in the physical model will be reflected in the SQL statement, so the statement can be copied directly when the table is built.
(iv) Physical model – Generate library tables
(v) Reverse generation of entities and mapping files
1. Add hibernate facet to Project
Right-click on Project--myeclipse--project facets[compabilities]--install Hibernate facet)
2. Open the DB browser view in MyEclipse:
In Id Generator, if it is a selectable native that needs to be increased in MySQL, if it is a selectable uuid.hex or UUID of the UUID
Complete. Entities and mapping files are generated in the corresponding directories set in the diagram.
(14) Hibernate reverse engineering