Automated generation of JPA entities

In many projects, we will be working with an existing database schema created by a database administrator. NetBeans can generate JPA entities from an existing database schema, which saves us a lot of potentially tedious work.

In this section, we will use a custom database schema. In order to create the schema, we need to execute an SQL script that will create the schema and populate some of its tables. In order to do this, we need to go to the Services window, expand Databases, right-click on JavaDB, and select the Create Database... option.

Automated generation of JPA entities

Then, we need to add the database information in the Create Java DB Database ...

Get Java EE 7 Development with NetBeans 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.