# 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 Java project" for more information.

1. Right-click the persistent project in the Package Explorer and select Java Persistence > Generate Entities.

   Generating Entities

2. 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.

Generating Entities from Tables

Generate Database DDL from Entities wizard