MyEclipse Hibernate Java entity class __ database by database

Source: Internet
Author: User
Tags generator

1, click Window->show view->db Browser, and then appear the following window


Right-key blank to select New, pop-up the following window:


First click on the Add Jars button, select the corresponding database JDBC driver (because I am using MySQL, so I chose the previous JDBC driver), after adding JDBC driver. Then select Driver template,driver name (optional), Connection URL, database username, database login password, then click Test Driver (test whether the database is connected successfully), and then click Finish. The Hibernate.cfg.xml configuration file is automatically generated in your project.

2, back to the DB browser window, double-click just to create a good data connection, that is good, find your database, and then find the table in the database, right-click Select Hibernate Reverse Engineering

Select the Project Java source folder (that is, Project/SRC), select Java pakcage (you can create it yourself), and then click Next, as shown


Id Generator Select Native, click Next, as shown in the picture


Click the database table that appears (I am here studentinfo), and then ID generator select native. Click Finish. Finally, the Java entity classes and the corresponding. hb.xml files appear in your project (I'm Studentinfo.java class and Studentinfo.hbn.xml files here). At this point, the Hibernate framework is used in MyEclipse, and the Java entity class and its corresponding configuration are created by reverse database, I wish you success.


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.