Skip Headers
Oracle® Fusion Middleware Programming Enterprise JavaBeans, Version 3.0, for Oracle WebLogic Server
11g Release 1 (10.3.6)

Part Number E13720-08
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
PDF · Mobi · ePub

6 Using Oracle TopLink with Oracle WebLogic Server

This chapter provides an overview of developing an Oracle TopLink application using Oracle WebLogic Server. The following topics are covered:

Overview of Oracle TopLink

Oracle TopLink is an advanced, object-persistence and object-transformation framework that provides development tools and run-time capabilities that reduce development and maintenance efforts, and increase enterprise application functionality.

Oracle TopLink includes support for EJB 3.0 in Java EE and Java SE environments, as well as support for EJB 2.n container-managed persistence (CMP). You can integrate Oracle TopLink with a variety of application servers, including Oracle WebLogic Server, OC4J, SunAS, JBoss, and IBM WebSphere.

For more information about developing, deploying, and configuring Oracle TopLink applications, see the Oracle Fusion Middleware Developer's Guide for Oracle TopLink.

When you use TopLink as the persistence provider in this release of WebLogic Server, you can install a patch that provides support for JPA 2.0. See Using JPA 2.0 with TopLink in WebLogic Server.

Integrating Oracle TopLink with Oracle WebLogic Server

You develop Oracle TopLink applications, as described in "Introduction to TopLink Application Development" in Oracle Fusion Middleware Developer's Guide for Oracle TopLink.

Before you can deploy Oracle TopLink applications on Oracle WebLogic Server, you must perform the following integration steps:

For complete details, see "Integrating TopLink with Oracle WebLogic Server" in Oracle Fusion Middleware Developer's Guide for Oracle TopLink. You also need to meet the requirements described in "Integrating TopLink with an Application Server" in the same document.

Using JPA 2.0 with TopLink in WebLogic Server

When you use Oracle TopLink as the persistence provider in this release of WebLogic Server, you can install a patch that provides support for Java Persistence Architecture (JPA) 2.0.

JPA 2.0 includes improvements and enhancements to domain modeling, object/relational mapping, EntityManager and Query interfaces, and the Java Persistence Query Language (JPQL). It includes a new API for criteria queries, a metamodel API, and support for validation. For the JPA 2.0 Specification, see "JSR-000317 Java Persistence 2.0 (Final Release)" at http://jcp.org/aboutJava/communityprocess/final/jsr317/index.html.

Note:

Support for JPA 2.0 in WebLogic Server is provided as a patch, because JPA 2.0 is part of Java Platform, Enterprise Edition (Java EE) 6. Therefore, enabling JPA 2.0 support in the current release results in WebLogic Server not meeting all Java EE 5 compatibility requirements. To maintain Java EE 5 compatibility in the current release, the files required for the support are not enabled by default, although they are included in a standard WebLogic Server installation.

To use JPA 2.0 in this release of WebLogic Server, do the following:

  1. Use Oracle TopLink as the persistence provider, as described in "Integrating TopLink with Oracle WebLogic Server" in Oracle Fusion Middleware Developer's Guide for Oracle TopLink.

  2. Install the patch, using either of the following two methods.

Installing Using Smart Update

Oracle Smart Update is a standalone Java application that simplifies the process of applying patches to your WebLogic Server installation. It is automatically installed in the Middleware home directory. You must have an active My Oracle Support account to use Smart Update.

To install the patch using Smart Update:

  1. Sign in to My Oracle Support at https://support.oracle.com/CSP/ui/flash.html. (You must create an account if you don't have one.)

  2. Locate and download the following patch: "Enable JPA 2.0 support on WebLogic Server."

    Note:

    The number and ID of the patch may change from release to release of WebLogic Server. In WebLogic Server 10.3.5, the patch is called "Patch 9923849: SU Patch [QWG8]: Enable JPA 2.0 support on WebLogic Server."

    For more information about locating and downloading a patch, see "Introduction" and "Downloading Patches" in Oracle Smart Update Installing Patches and Maintenance Packs.

  3. Unzip the downloaded patch and use the Smart Update tool install it, as described in "Starting Smart Update" and "Applying Patches" in Oracle Smart Update Installing Patches and Maintenance Packs.

Using Smart Update to apply the patch does the following:

  • The patch file is copied to MW_HOME/patch_wls1036/patch_jars.

  • MW_HOME\patch_wls1036\profiles\default\sys_manifest_classpath\weblogic_patch.jar is added in the CLASSPATH by FMW_HOME/wlserver_10.3\common\bin\setPatchEnv.cmd.

  • You can use the standard startWeblogic.cmd or startWeblogic.sh to start the server. No further modification is required.

  • If you use a custom script to start the server, you may need to put MW_HOME\modules\javax.persistence_1.1.0.0_2-0.jar;%wls_modules%\com.oracle.jpa2support_1.0.0.0_2-0.jar or MW_HOME\patch_wls1036\profiles\default\sys_manifest_classpath\weblogic_patch.jar at the beginning of CLASSPATH. See Installing Manually, for suggestions on how to do this.

Installing Manually

The files required for supporting JPA 2.0 are included with a default WebLogic Server installation, but they are not enabled by default. The files are installed in the WL_HOME\modules directory. The files are:

  • The javax.persistence_1.1.0.0_2-0 JAR file contains the JPA 2.0 libraries.

  • The com.oracle.jpa2support_1.0.0.0_2-0.jar file contains the files for enabling JPA 2.0 support in WebLogic Server.

If you do not have an active My Oracle Support account (which you need to use Smart Update) you can install the patch manually by putting the files at the start of the WebLogic classpath. For example, you can use either of the following ways:

  • Define a PRE_CLASSPATH environment variable before starting WebLogic Server.

    For example, in a Windows console window, run the following script before running startWebLogic.cmd:

    @echo off
    if ".%1" == "." goto TellSyntax
    set wls_modules=%1
    set PRE_CLASSPATH=%wls_modules%\javax.persistence_1.1.0.0_2-0.jar;
    %wls_modules%\com.oracle.jpa2support_1.0.0.0_2-0.jar
    goto End
    :TellSyntax
    echo setJPA2SupportPatch [path-to-weblogic-modules-directory
    :End
    echo PRE_CLASSPATH=%PRE_CLASSPATH%
    

    A similar script can be written for Linux, UNIX, or Macintosh.

  • Modify the commEnv.cmd or commEnv.sh script in the WL_HOME/common/bin directory, and define the PRE_CLASSPATH at the beginning of the script.