Hibernate (4) _ Reverse create a Domain object and object relationship ing file from the table,
We used to write.Domain objectAndObject link ing File-> Then generateTable.
Now, we will first build a database.Table-> GenerateDomain objectAndObject link ing File.
Steps:
1. Create a web Project
2. Provided by myeclipseDatabase BrowserConnect to our database.
① Create a database connection:
② Configure the database connection (Here we use an oracle image, followed by the configuration under the SQL server database, which can be ignored without affecting ):
Fill in the driver information here and introduce the driver package.
③ Enter the logon password to enter the database after the operation is successful:
Right-click a table to directly modify and delete the table. Of course, this is equivalent to directly modifying the data in the database. For example, edit data can be directly operated on the table.
You can also use SQL statements to perform operations:
3.IntroductionHibernate Development KitAnd automatically create the hibernate. cfg. xml file.
After the above database connection is introduced into the driver, the driver configured previously can be matched here.
4. Below we useReverse Engineering,Automatic CreationDomain class and object relationship ing File.
Java object (attribute) <--------- 1. java type 2. hibernate types -------------> table field type (two matching types, common java matching types)
After the reverse engineering is completed, a pojo object and an object ing file are generated.