This chapter provides an overview of developing an Oracle TopLink application using Oracle WebLogic Server. The following topics are covered:
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 use 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.
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:
If JTA is used, configure the external transaction controller as required.
Use deployed JMX MBeans to configure your Oracle TopLink sessions at run-time.
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.
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:
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.
Install the patch, using either of the following two methods.
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, do the following:
Ensure that you are logged in to My Oracle Support. For information, see http:\\support.oracle.com
.
Start Smart Update, as described in "Starting Smart Update."
In the Target Installation panel of the main Smart Update window, select the target installation.
Select the Get Patches tab.
In the available patches panel, select the check box for patch QWG8 - Enable JPA 2.0 support on WebLogic Server.
Click Download Selected.
Select the Manage Patches tab.
In the Downloaded Patches panel, select the patch, then click the Up Arrow button under Apply.
For more information on using Smart Update, see Oracle Smart Update Installing Patches and Maintenance Packs.
Using Smart Update to apply the the patch does the following:
A folder FMW_HOME
/patch_wls1034
is created, and the patch files are copied to that directory.
FMW_HOME
\patch_wls1034\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 FMW_HOME
\javax.persistence_1.0.0.0_2-0-0.jar;%wls_modules%\com.oracle.jpa2support_1.0.0.0_2-0.jar
or FMW_HOME
\patch_wls1034\profiles\default\sys_manifest_classpath\weblogic_patch.jar
at the beginning of CLASSPATH. See Installing Manually, for suggestions on how to do this.
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.0.0.0_2-0-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.0.0.0_2-0-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.