Hibernate (iv) __ Create a domain object and an object-relational mapping file from a table

Source: Internet
Author: User

Before we were handwritten domain objects and object-relational mapping files , and then generated the Table in the database.

Now we're going to start by building the Tablein the database and then using the tool to generate the domain object and the Object Relational mapping file .

Steps:

1. Create a Web project

2. Connect to our database via the database browser provided by MyEclipse.

① Create a new database connection:

② Configuration database connection (borrowed here with Oracle a graph, followed by the configuration under the SQL Server database, can be ignored without affecting):

③ after successful enter the login password to enter the database:

The right-click table can directly modify the delete table, which is also equivalent to directly modify the data in the database, such as edit data can be directly on the table operation.

You can also operate with SQL statements:

3. Introduction Hibernate Development Package . hibernate.cfg.xml files are also created automatically .

4. Below we use the reverse engineering provided by MyEclipse to automatically create the domain class and Object relational mapping file .

Java Objects (properties) <---------1. Java type 2. Hibernate types-------------> table field type (two matching types, common Java match types)

After the reverse engineering is completed, the Pojo object and object mapping files are generated.

Hibernate (iv) __ Create a domain object and an object-relational mapping file from a table

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.