Generating Entities from Tables |
Use this procedure to generate Java persistent entities from database tables. You must add persistence to your project and establish a database connection before generating persistent entities. See "Adding Persistence to a Project" for more information.
Right-click the persistent project in the Package Explorer and select Java Persistence > Generate Entities.
On the Generate Entities from Tables Dialog dialog, select the tables from which to generate Java persistent entities and click Finish.
Eclipse creates a Java persistent entity for each database table. Each entity contains fields based on the table's columns. Eclipse will also generate entity relationships (such as one-to-one) based on the table constraints. Figure: Generating Entities from Tables illustrates how Eclipse generates entities from tables.