Hibernate is one of the most common implementations of JPA, and hiberante itself supports annotation syntax. Now don't look at that heap of XML mappings anymore. And Eclipse also provides tools to generate the entity class directly from the database.
I. Project Add JPA tool
Now add the existing project to JPA support, first select project right properties->project Facets tick list project Facts under JPA option, OK to select Transfer to database connection configuration
>> Click Furhter Configuration Available
Platform Select Generic, JPA implements type select Disable library configuration because the required jar files have been placed in the Lib directory under Web-inf. So do not configure. Again the following connection this is necessary to configure.
Second, configure the data connection
To add a database connection, select an Oracle database for example:
Determine the configuration information.
III. Configuration item JPA build entity
above configuration complete, right-click on the project folder to select JPA tools->generate entities from Tables. After:
Choose the built connection if you don't have connect, connect. will be as shown (sometimes eclipse will have some small problems to see the table, you can restart the test, it is not possible to build a JPA project directly, create the entity and then copy to your own project.) Select the table for which you want to generate the entity, Next:
above is the relationship between the tables, if you can make the corresponding changes (using Ecipse 3.5 looks like eclipse3.4 has not this function, Eclipse is getting stronger), and then next, such as:
iv. removal of unnecessary error warnings
Eclipse automatically generates annotation entities from JPA