Hibernate Reverse Engineering (eclipse and myeclipse)

Source: Internet
Author: User
Tags jboss

Hibernate Reverse Engineering (eclipse and myeclipse)

How to extract the pattern information of the database, and try it through the reverse tool of hibernate.

1. Reverse Engineering of hibernate under myeclipse:

1. Select the myeclipse hibernate View

2. Establish a connection with the background database

1) Configure database driver;

2) Add the corresponding database driver;

3) Add the jar package corresponding to the driver;

4) configure the link parameters (example: JDBC: oracle: thin: @ 10.3.15.30: 1521: wmdev)

3. Open the database connection and select the corresponding table

4. Right-click the data table object and select hibernate reverse engineering.

5. Select the path of the file to be generated: Java SRC folder, Java package

6. Check the Java data object check box and finish. After the result is generated, you can see the generated pojo file in the path in step 1.

 

Reverse Engineering in eclipse

 

 

Step 1: Install hibernate tools
1. log on to the JBoss website to download the plug-in.
Http://www.jboss.org/tools/download.html
2. Select update sites to install the hibernate plug-in.
Http://www.jboss.org/tools/download/dev
I chose to install the 3.2bata2 development edition. You can select the 3.1ga official edition.

 

Supplement: the preceding two websites may not be available. You can try the following URL.

Install the hibernate plug-in

Http://download.jboss.org/jbosstools/updates/development

Http://download.jboss.org/jbosstools/updates/stable/

 

3. After hibernate tools is successfully installed, create a new Java project named hibernatetest.

Click Finish and add the hibernate library file and the MySQL driver as follows:


Open the hibernate deployments view, and choose Window> show View> other...

In the blank area of the hibernate tolerations view, right-click Add tolerations. Here we enter the "hibernate" name. You can name it another one and it will be called later.


The pop-up configuration window is as follows:

Project: browse select a project for Reverse Engineering

Database Connection: hibernate configured connection

Configuration File: Setup



Fill in the data connection related content, such as IP address, database name, account, password, etc. Click Finish to complete the configuration.

The following code is generated based on the configuration.



Double-click or right-click to create a new configuration


After the configuration name is modified, click Apply.


Console configuration: select the created hibernate Configuration
Output directory: select the project name/src directory for the output directory.
Package name: www. DB. pojo.

Switch to the exporter tab to continue setting


Click Apply to complete the settings. Click Run to generate a Java object class based on the database.

The running result is as follows:

Because the generated object class implements java. Io. serializable, a yellow exclamation point is generated by right-clicking




Eclipse J2EE 3.6.1: Help Menu-> install new software...

Alternatively, you can download the plug-in for local installation.

Related Article

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.