We require the JPA project facet to create entity beans. We could have created a JPA project to start with, but to create a session bean facade we first created an EJB project; session beans require an EJB project by default. To add the JPA project facet, right-click on the project in Project Explorer and select Properties. Select the Project Facets node and select the JPA 1.0 project facet. Click on the Further configuration available link as shown in the screenshot:
In JPA Facet, select Platform as Generic 1.0. Select JPA implementation as Oracle TopLink 11g R1. We also need a database connection for JPA. To configure a new Connection, click on the Add connection link as shown in the following screenshot:
In Connection Profile, select the Oracle Database Connection profile, specify a connection Name and click on Next as shown in the following screenshot:
In the Specify a
Driver and Connection Details window, select the driver as Oracle Database 10g Driver. Specify SID as XE
, Host as localhost
, Port number as 1521
, User name as OE
, and Password as OE
. The Connection URL gets specified. Now, click on Test Connection as shown in the following screenshot:
A Ping succeeded message indicates that the connection got established. Click on Next and then click on Finish in Summary. A Connection for the JPA Facet gets configured. Click on OK as shown in the following screenshot:
The connection profile we have configured is for the JPA project facet, not to run client applications to entity beans. The data source we configured in the WebLogic server with JNDI jdbc/OracleDS is for running client applications to entity beans. Click on Apply in Properties to install the JPA facet as shown in the following screenshot:
A node for JPA Content gets added to the EJB project. A persistence.xml configuration file gets added.