Creating the entity beans
Next, we shall map the database tables that we created to the entity beans. But, before we may generate the entity beans from tables, we need a database connection. Using the procedure explained in some of the earlier chapters, create a database connection (OracleDBConnection) to an Oracle database.
Select the project properties for the EJB3Model project and select the EJB Module node. The data source name corresponding to the OracleDBConnection is jdbc/OracleDBConnectionDS.
To create the entity beans from tables select File | New, and in the New Gallery window, select Business Tier | EJB in Categories and Entities from Tables in the Items header, as shown in the following screenshot. Click on OK.
Click on New in the Persistence Unit window. In the New Persistence Unit window, specify a persistence unit name (em), and specify a JTA Datasource Name, which is the datasource we created earlier. When we use a JTA datasource with transaction type JTA (the default), the...