The Hibernate tools plugin is implemented in Eclipse to reverse generate Hibernate annotated entity classes from the database

Source: Internet
Author: User
Tags jboss

First, install Hibernate tools Plugin

1, online installation

Via the eclipse's Help->install New software online installation plugin, the plug-in connection is:

    • Eclipse Helios (3.6) edition

Add the following address: http://download.jboss.org/jbosstools/updates/stable/helios/

Optional installation: Hibernate tools under the all Jboss tools node

    • Eclipse Indigo (3.7) edition

Add the following address: http://download.jboss.org/jbosstools/updates/development/indigo/

Choose Hibernate Tools under JBoss Web and Java EE development.

    • Other versions
Download yourself: http://www.jboss.org/tools/download.html I used the Eclipse 3.7 version of Indigo, as shown in:

2, after the successful installation, you create a new project test.

Second, the specific implementation of the connection database process using text and graphics to explain

1. Open window-> Show View->other, then open the Database Manager (data Management)->data Source Explorer, and then database connection right-click New, and connect to the database.

2, click the button, create a new database-driven configuration.

Select the database driver, and you can give the configuration a different name.

Next, complete the contents of the General tab under Properties, as well as connect to the database, click the Test Connection button when you are finished configuring the database, then click Next.

When you are sure of the error, click Finish.

Iii. concrete steps for generating Hibernate entity classes

Open the Hibernate configurations window.

Then right-click on the Open window and click Add Configuration ...

Project Select item (ph), database connection Select just well-equipped DB connection driver, if not built database driver can click New New database driver (in fact, you can directly select the [Hibernate configured Connection] connection to the database through the Hibernate configuration file, but this way does not necessarily succeed, the use of data Management alone is also not necessarily successful, the reason is not very clear, so the final adoption of data Management + Hibernate configuration file in a way that is more insurance)

Click OK to add a configuration message to hibernate configuration.

After the configuration file is created, you can see the database node in the Hibernate configuerations view.

Then right-click in the blank space of the toolbar in the Eclipse menu bar and select Customize perspective.

After the form appears, select the Hibernate Code Generation by selecting the Command Groups Availability tab in the diagram, and then click OK.

The toolbar will then appear with the corresponding button.

Click the button and select Hibernate Code Generation configurations in the diagram.

Then pop up the window below, press as action, right click after select New.

Pop up the form below, select the project address for the output, fill in the package name, tick reverse engineer from JDBC Connection, and create Hibernate.reveng.xml

Hibernate.reveng.xml the resulting path through the following step selection, the path after the selection of click Next, the following interface appears, Console configuration Select just configured Hibernate, click the Refresh button, The database will appear all schema, find your database, and then will need to produce the entity class of the table its include to the right window, and then click the Finish button to complete the creation of Hibernate.reveng.xml.

Then click Run and you will be able to generate the corresponding entity class and configuration file in the appropriate directory of the project or directly the entity class with the annotation map.

Related reference URL: http://blog.csdn.net/wangpeng047/article/details/6877720

Http://www.cnblogs.com/whjblogs/p/3137385.html

Http://www.2cto.com/database/201501/372023.html


Using Hibernate tools plug-ins in eclipse to generate a hibernate-annotated entity class from a database in the form of a plugin

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.