Hibernate reverse engineering in eclipse generates HBM. xml and bean classes

Source: Internet
Author: User

Myelipse has been used in the past. It is quite easy to do hibernate reverse engineering in myeclipse.

However, I recently switched to eclipse and started to not install the Eclipse plug-in. After a few days, I finally installed the plug-in, but it won't be used for reverse engineering.

I finally found it on a foreign website:

Http://iablog.sybase.com/paulley/2009/02/reverse-engineering-sql-anywhere-with-hibernate-tools-part-trois/

I will introduce how to generate HBM. xml and classes:

Prerequisites

1. There is a project and hibernate 3.x has been added.

2. There is a corresponding database. It is not associated.

 

Then we officially started

1. Add hibernate. cfg. xml

Right-click the project --> New --> other ---> Search (hibernate) --> select "hibernate configuration file (CFG. XML) "--> next --> select the project name --> next --> Fill in the necessary information for connecting to the database --> finish

Figure:

 

2. Add the hibernate Configuration:

Click project --> New --> other ---> Search (hibernate) --> select "hibernate console configuration ". The following page is displayed:

 

3. Add hibernate. reveng. xml.

 

Right-click the project --> New --> other ---> Search (hibernate) --> select "hibernate reverse engineering file (reveng. XML)" --> next.

Such:

After completing the preceding steps, the system will create and open hibernate. reveng. XML, and then perform the following operations:

After adding the file, save and close the file.

4. Generate HBM. xml and bean.

In hinbernate mode.

In the specified directory, we can see the generated file.

The error is because no package location is specified. open the file and add it.

The main example is package com. Polaris. FW. Crud. Test.

 

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.