# Configuring a JPA Project to Use EclipseLink Persistence Provider

EclipseLink is an open source persistence provider contributed to Eclipse by Oracle.

For more information, see the "EclipseLink User's Guide - Developing JPA Projects" which is available on the Eclipse site at `http://wiki.eclipse.org/EclipseLink/UserGuide/Developing_JPA_Projects_%28ELUG%29`.

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: Even though the library files are not shipped with earlier version of Oracle WebLogic Server, you can download them using the facet configuration wizard. For more information, see Oracle WebLogic Server Support for Persistence Provider Libraries and Deployment.

- 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 methods described below.

To automatically configure your JPA project to use EclipseLink persistence provider shipped with Oracle WebLogic Server 11gR1:

1. If necessary, create a new JPA project. From the main menu, select File > New > JPA Project.

   In the New JPA Project dialog, choose the `Oracle WebLogic Server 11gR1` as the Target Runtime and complete the details on the New Server Runtime Environment dialog.

2. Click Modify in the Configuration portion on the New JPA Project > JPA Project dialog. This opens the Project Facets dialog.

3. Select Java Persistence Library (EclipseLink) from the Project Facet list, and then click OK to apply your selection and close the Project Facets dialog.

4. Click Next on the New JPA Project > JPA Project dialog.

5. On the next, JPA Facet screen of the New JPA Project dialog, select EclipseLink as the platform for your project.

6. Specify the database connection in the Connection field.

7. In the JPA implementation portion of the New JPA Project dialog, select Use implementation provided by server runtime, and then click Next. This opens the New JPA Project > EclipseLink screen.

8. Select EclipseLink version-number, and then click Finish. Note that if the EclipseLink library is not listed, you need to click Download library. 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.

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.

The `persistence.xml` file of your JPA project now contains EclipseLink persistence provider settings.

To manually configure a Java user library which includes the EclipseLink JAR files that you downloaded separately:

1. When creating a new JPA project, select Oracle WebLogic Server 11gR1 as your target runtime.

2. Click Modify in the Configuration portion on the New JPA Project > JPA Project dialog. This opens the Project Facets dialog.

3. Select `Java Persistence Library (EclipseLink)` from the Project Facet list, and then click OK to apply your selection and close the Project Facets dialog.

4. 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.

5. 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 opens the New JPA Project > EclipseLink dialog. Click Download library. This opens the 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.

6. Add the EclipseLink library to your Eclipse JPA project's build path.