Reprint please specify the original address: http://www.cnblogs.com/ygj0930/p/6768513.html
One: Reverse engineering
MyEclipse provides the ability to generate Java Pojo and Hibernate mapping files from database tables, which is reverse engineering.
Two: Get Pojo class and mapping file by reverse engineering
1: Click on the "upper right corner of the development interface" to select the Database Explorer interface.
2: Right-click the menu in the blanks and select New.
In the following interface, select the database type, name this connection, database path, account, password, add driver package.
3: Double-click the database connection you just created to start, then tap, open. Locate the database table that you want to convert.
4: Right-click on the table to be converted and select Hibernate Reverse engineering (reverse engineering).
In the following interface, in order to specify the directory for the contents of the transformation, conversion options: Generate Pojo class, generate Pojo mapping file
5: The following interface just select the primary key generation strategy, other default, click Next.
6: Tick the two include below.
7: Click Finish.
Third: The Pojo class with annotations is obtained by reverse engineering
The reverse engineering of generating annotated Pojo classes requires Myeclipse8 or later.
Only in this step: choose to generate not a mapping file, but instead add annotations to the Pojo class. The remaining steps are the same as before.
Four: Rapid development using reverse engineering
1: Create project, add hibernate support, automatically generate Hibernatesessionfactory and Hibernate.cfg.xml.
2: Enter Databaseexplorer to configure the database connection.
3: Using reverse engineering to get Pojo classes and mapping files
4: Use session to persist in DAO layer
5: Transaction management at service, filter layer
Hibernate Learning Note Five: Reverse engineering rapid development