7 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:

  • Jakarta Persistence (JPA)

    For the complete JPA specification, see https://jakarta.ee/specifications/persistence/.

  • Jakarta XML Binding (JAXB). The EclipseLink JAXB implementation, plus EclipseLink extensions, is called MOXy.

    For the JAXB specification, see https://jakarta.ee/specifications/xml-binding/.

  • EclipseLink also includes Database Web Service (DBWS), which provides access to relational database artifacts by using a Jakarta 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:

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 Remote Console or by directly setting JPAMBean.DefaultJPAProvider.

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 jakarta.persistence.provider property passed to the Map parameter of the jakarta.persistence.Persistence.createEntityManagerFactory(String, Map) method.