Hibernate Learning Note Five: Reverse engineering rapid development

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.