Object-Relational Mappings: Configuring the Persistence Provider for JPA Projects
EclipseLink is an open source persistence provider contributed to Eclipse by Oracle.
OEPE provides an EclipseLink project facet that you can use in your Eclipse JPA project. When selected, the following happens:
- the project build path is automatically configured to include EclipseLink persistence provider JAR files shipped with Oracle WebLogic Server 11gR1.
Note that, even though the library files are not shipped with earlier version of Oracle WebLogic Server, you can download them using the facet configuration wizard.
- the database connection properties specific to EclipseLink can be automatically configured in the
persistence.xml file of your Eclipse JPA project.
Oracle WebLogic Server releases prior to 11gR1, as well as third-party J2EE application servers, support EclipseLink persistence provider through the user library provider mechanism. For more information, see Oracle WebLogic Server Support for Persistence Provider Libraries and Deployment.
To configure your Eclipse JPA project to use EclipseLink as a persistence provider, use one of the following options:
- Automatically configure your JPA project to use EclispeLink persistence provider shipped with Oracle WebLogic Server 11gR1, as follows:
If you expand your JPA project node in the Project Explorer, and then expand the EclipseLink node, you will find the EclipseLink persistence provider library, as well as Java persistence library, as Figure 3 shows.
Figure 3. Persistence Libraries
persistence.xml file of your JPA project now contains EclipseLink persistence provider settings, as Figure 4 shows.
Figure 4. persistence.xml File
- Manually configure a Java user library which includes the EclipseLink JAR files that you downloaded separately, as follows:
- When creating a new JPA project, select Oracle WebLogic Server 11gR1 as your target runtime.
- Click Modify... in the Configuration portion on the New JPA Project > JPA Project dialog. This will open the Project Facets dialog, as Figure 5 shows.
Figure 5. Project Facets Dialog
- Select Java Persistence Library (EclipseLink) from the Project Facet list, and then click OK to apply your selection and close the Project Facets dialog.
- Click Next on the New JPA Project > JPA Project dialog.
- On the next, JPA Facet screen of the New JPA Project dialog, select EclipseLink as the platform for your project, and then specify the database connection in the Connection field.
- In the JPA implementation portion of the New JPA Project > JPA Facet dialog, leave the default selection of Use implementation provided by server runtime, and then click Next. This will display the New JPA Project > EclipseLink screen. Click Download library. This will open Download Library dialog. Select the EclipseLink library you would like to use, and click Next. Note that if your machine is located inside of a network, which requires a proxy to access outside resource such as the Internet, the download may fail due to the fact that Eclipse IDE includes a Web browser to let you access the Internet from within the IDE. In this case, reconfigure your Eclipse IDE proxy settings using Window > Preferences > General > Network Connections, and try again.
- Add the EclipseLink library to your Eclipse JPA project's build path.
2. Configuring a JPA Project to Use Kodo Persistence Provider
Oracle Kodo is the default persistence provider for Oracle WebLogic Server 10n. OEPE enables automatic configuration and deployment of Eclipse JPA projects that use Kodo as their persistence provider on Oracle WebLogic Server.
OEPE provides Oracle Kodo facet that allows you to configure your JPA project to use Oracle Kodo as the persistence provider. When selected, the following happens:
- the project build path is automatically configured to include Oracle Kodo persistence provider JAR files shipped with Oracle WebLogic Server;
- the database connection properties specific to Oracle Kodo can be automatically configured in the
persistence.xml file of your Eclipse JPA project.
Note that earlier versions of Kodo require a build-time class enhancement process. OEPE triggers execution of a Kodo-specific class enhancer on your Kodo JPA project when deployed to Oracle WebLogic Server 10.0. For more information, see Oracle WebLogic Server Support for Persistence Provider Libraries and Deployment.
To configure your Eclipse JPA project to use Oracle Kodo as a persistence provider, follow this procedure:
If you expand your JPA project node in the Project Explorer, and then expand the WebLogic System Libraries node, you will find the Oracle Kodo persistence provider library, as well as Java persistence library, at the end of the list, as Figure 8 shows.
Figure 8. Persistence Libraries
persistence.xml file of your JPA project now contains Oracle Kodo persistence provider settings, as Figure 9 shows.
Figure 9. persistence.xml File
3. Oracle WebLogic Server Support for Persistence Provider Libraries and Deployment
Oracle WebLogic Server 10.3.5 supports the EclipseLink persistence provider.
The following table maps the current version of Oracle WebLogic Server and supported persistence libraries:
|Oracle WebLogic Server Version
11g Release 1 (10.3.5)
- Oracle WebLogic Server system library (Oracle TopLink 11g Release 1 (10.3.4))
- EclipseLink version 2.1.2 and earlier downloadable libraries
4. Related Information
Getting Started With the Oracle Database Plugin for Eclipse
EclipseLink User's Guide - Developing JPA Projects