# New Entity Classes from Database Wizard: Database Tables

Use to generate a set of entity classes based on tables from an existing database connection or schema. In this wizard, you choose the data source or connection to your database and the tables in that database with the fields that you want to persist. The IDE then generates an entity class for each of these tables and any related tables with persistent fields.

Use this page of the wizard as follows:

1. Select one of the following:

   - Data Source. Select this option if you want to generate the entity classes directly from a database. Select the JNDI name of the data source from the drop-down list. If the data source you want is not listed, choose New Data Source in the drop-down list.

     - When choosing a data source, the server must be running and the data source must be registered with the server.
     - The drop-down list contains the database connections registered with the IDE if your target server is not a Java EE container or if the target project is a Java SE project.
   - Database Schema. Select this if you already have a database schema you want to use. The drop-down list displays the database schemas that are found in the `src/conf` directory of your project.

2. Select any tables in the left panel and click Add. If the table references other tables, the referenced tables are automatically added to the Selected Tables list in the right pane. The referenced tables are greyed out to indicate that they are referenced tables. You can place your cursor over the referenced tables to see a tooltip indicating which table references the table. The IDE automatically generates entity classes for each of the tables listed in the right pane.

   - If you do not want entity classes created from referenced tables, deselect Include Related Tables.
   - You can use the drop-down list to filter the Available Tables.
3. Click Next to confirm the entity class names and specify where to save the entity classes.

Related Topics

Developing Applications with NetBeans IDE,

Copyright © 2015, Oracle and/or its affiliates. All rights reserved.