Creating JPA entity beans in a JPA-enabled web project from existing database tables

You can create JPA entity beans for a JPA-enabled web project by generating the beans from existing database tables.

Procedure

  1. In Enterprise Explorer, right-click your JPA-enabled web project and select JPA Tools > Generate Entities From Tables. The Generate Custom Entities wizard opens.
  2. On the Select Tables page of the wizard, specify the connection name and the connection schema.
  3. In the Tables list, select the tables for which you want to generate entities.
  4. Click List generated classes in persistence.xml. This option enables automatic synchronization of the persistence.xml with any JPA resources in your workspace.
  5. Click Next
  6. On the Table Associations page of the wizard, click the + button to create an association. The Create New Association wizard opens.
  7. Create an association. Click Finish to exit the Create New Association wizard.
  8. Customize the default entity generation and click Next.
  9. Customize individual entities.
  10. Click Finish.

Results

The JPA entity beans are added to your web project. You can view them in the JPA Content node.
Icon that indicates the type of topic Task topic
Timestamp icon Last updated: July 17, 2017 21:58

File name: tjpacrtentitybeanstables.html