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 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, and then finish. After the generation is completed, you can see the generated pojo file under the path in step 5.
Reverse engineering under eclipse
Step 1: Install hibernate tools
1. Log in to the jboss website to download the plug-in
http://www.jboss.org/tools/download.html
2. Select the Update Sites network to install the Hibernate plug-in
http://www.jboss.org/tools/ download/dev
I choose to install the 3.2bata2 development version, you can choose the 3.1ga official version
Supplement: The above two URLs may not be available. You can try the following URL.
Install the Hibernate plugin
http://download.jboss.org/jbosstools/updates/development
http://download.jboss.org/jbosstools/updates/stable/
3, After successfully installing hibernate tools, create a new java project named HibernateTest
Click Finish to complete, and add the hibernate library file and mysql driver as follows
Open the Hibernate Configurations view, menu Window -> Show View -> Other...
Create Add Configurations in the blank area of the Hibernate Configurations view, here the name I filled in "hibernate", you can name it other, it will be called in a while
The pop-up configuration window is as follows
Project : Browse to select a project that needs to be reverse engineered
Database Connection: Hibernate Configured connection
Configuration File: Setup
Fill in the data connection related content, such as IP, database name, account, password, etc. Click Finish to complete the configuration
Let's start to create reverse generated code according to the configuration
Double-click or right-click to create a new configuration in the menu
After modifying the configuration name, click the Apply button to take effect
Console configuration: Select the hibernate configuration you just created.
Output directory: Select the output directory as the project name/src directory.
Package name I filled in www.db.pojo.
Switch to the Exporter tab to continue the setup
Click the Apply button to complete the setting, click the Run button to generate the JAVA entity class according to the database
The running result is as follows
Since the generated entity class implements java.io.Serializable, there will be a yellow exclamation mark, right click to generate a
eclipse j2ee 3.6.1: help menu -> Install New Software...