Generating JPA entities from database tables
Now we can generate the JPA entities from the ITSOBANK database into the JPA project. Perform these steps.
| In the Project Explorer, right-click the RAD75JPA project and select JPA Tools Æ Generate Entities.
|
| In the Generate Entities wizard, Database Connection page, the connection (ITSOBANKderby) and schema (ITSO) are preselected. Click Next (Figure | 2-3).
|
Figure 12-3 Generate Entities: Database Connection
For Package, type itso.bank.entities.
|
Select Synchronize Classes in persistence.xml so that the generated classes are added to the file.
|
Click Select All to select the four tables.
|
Overwrite the entity name for the TRANSACT table as Transaction.
|
Click Finish.
|
Figure 12-4 Generate Entities: Tables
| The itso.bank.entities package with three classes is generated, and the three classes are added to the persistence.xml file.
|