8 Configuring the Persistence Provider in Oracle WebLogic Server

This chapter describes Oracle TopLink, the default persistence provider in Oracle WebLogic Server, and introduces how to use it. This chapter also tells how to set the default persistence provider in WebLogic Server.

This chapter includes the following sections:

Overview of Oracle TopLink

Oracle TopLink is the default persistence provider in WebLogic Server 12c and later. It is a comprehensive standards-based object-persistence and object-transformation framework that provides APIs, schemas, and run-time services for the persistence layer of an application.

The core component of TopLink is the EclipseLink project's produced libraries and utilities. EclipseLink is the open source implementation of the development framework and the runtime provided in TopLink. EclipseLink implements the following specifications, plus value-added extensions:

  • Java Persistence 2.1 (JPA 2.1).

    JPA 2.1 includes new support or enhancements for features including Criteria Bulk Update/Delete, stored procedures, JPQL Generic function, injectable entity listeners, TREAT, converters, DDL generation, and entity graphs. For the complete JPA 2.1 specification, see "JSR-000338 Java Persistence 2.1 (Final Release)" at http://jcp.org/aboutJava/communityprocess/final/jsr338/index.html.

  • Java Architecture for XML Binding (JAXB) 2.2. (The EclipseLink JAXB implementation, plus EclipseLink extensions, is called MOXy.)

    For the JAXB 2.0 specification, see "JSR-000222 Java Architecture for XML Binding (JAXB) 2.0 " at http://jcp.org/aboutJava/communityprocess/pfd/jsr222/index.html.

  • EclipseLink also includes Database Web Service (DBWS), which provides access to relational database artifacts by using a Java API for XML Web Services (JAX-WS) 2 Web service.

EclipseLink also provides support for Oracle Spatial and Oracle XDB mapping.

For more information about EclipseLink, including other supported services, see the EclipseLink project home at http://wiki.eclipse.org/EclipseLink and the EclipseLink Documentation Center at http://wiki.eclipse.org/EclipseLink/UserGuide.

In addition to all of EclipseLink, Oracle TopLink includes:

  • TopLink Grid, an integration between EclipseLink JPA with Oracle Coherence that allows EclipseLink to use Oracle Coherence as a level 2 (L2) cache and persistence layer for entities. See Developing Applications with Oracle Coherence

    Note:

    You must have a license for Oracle Coherence to be able to use TopLink Grid.

  • Logging integration with WebLogic Server.

  • MBean support in WebLogic Server.

For information about developing, deploying, and configuring Oracle TopLink applications, see the following:

Note:

The preceding documents are for Oracle TopLink 12.1.3, but they also apply to the current version of WebLogic Server.

See also the following EclipseLink resources:

Specifying a Persistence Provider

You can specify what persistence provider to use for a persistence unit in the application code or by accepting the default persistence provider set for the WebLogic Server domain, as described in the following sections:

Setting the Default Provider for the Domain

Unless you specify otherwise, TopLink is used as the default persistence provider for a WebLogic Server domain. The default provider is used for any entities in an application that are not configured to use a different persistence provider. The default provider is used for both injected and application-managed entity managers and factories.

You can set the default provider in the WebLogic Server Administration Console or by directly setting JPAMBean.DefaultJPAProvider.

Note:

Oracle Kodo JPA/JDO is not supported in this release of WebLogic Server. Customers are encouraged to use Oracle TopLink, which supports JPA 2.1. Kodo supports only JPA 1.0.

For instructions on setting the default through the WebLogic Server Administration Console, see Configure the Default JPA Persistence Provider in Oracle WebLogic Server Administration Console Online Help.

If you change the default provider, you must do the following for any deployed applications that do not specify a JPA provider:

  • Restart applications that use application-managed entity manager factories.

  • Redeploy applications that use injected entity manager factories or entity managers.

Specifying the Persistence Provider in an Application

A persistence provider specified in an application takes precedence over the default provider set for the WebLogic Server domain.

You can set the provider to use in the following ways:

  • Specify the provider in the <provider> element for a persistence unit in the persistence.xml file, for example:

     <persistence-unit name="example">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    ...
      </persistence-unit>
    
  • Specify the provider in the javax.persistence.provider property passed to the Map parameter of the javax.persistence.Persistence.createEntityManagerFactory(String, Map) method.

Using Oracle TopLink in Oracle WebLogic Server

For detailed information about using Oracle TopLink in WebLogic server, see Using TopLink with WebLogic Server in Solutions Guide for Oracle TopLink. Note that this is an Oracle TopLink 12.1.3 publication, but it applies to the current version of WebLogic Server.