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