Programming WebLogic Enterprise JavaBeans, Version 3.0

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Using Kodo with WebLogic Server

This chapter provides an overview of developing, deploying, and configuring a BEA Kodo application using WebLogic Server: The following topics are covered:

 


Overview of Kodo

BEA Kodo an implementation of Sun Microsystem’s Java Persistence API (JPA) specification and Java Data Objects (JDO) specification for transparent data objects. BEA Kodo is available as a stand-alone product and is integrated within WebLogic Server.

This chapter describes how to implement an application using JPA or JDO in WebLogic Server. Within WebLogic Server, the JPA and JDO implementations are part of WebLogic Servers overall Enterprise Java Bean 3.0 persistence implementation.

For general information on creating an application using JPA and JDO, see the Kodo Developer’s Guide.

 


Creating a Kodo Application

The first step in implementing a BEA Kodo application on WebLogic Server is to write your application’s code. The following resources provide general information on writing an application that uses BEA Kodo to manage persistence of your data:

Once you are familiar with the steps involved in creating applications using BEA Kodo and have created your application, the following sections describe how to deploy and configure your application using WebLogic Server.

 


Using Different Kodo Versions

If you choose to use a different version of Kodo than the one provided by default within WebLogic Server, you must use the FilteringClassLoader to exclude the Kodo and OpenJPA libraries from the component classpath.

The following example shows how to exclude these class libraries using weblogic-application.xml:

<prefer-application-packages>
<package-name>org.apache.openjpa.*</package-name>
<package-name>kodo.*</package-name>
</prefer-application-packages>

For more information on filtering classloaders, see “Understanding WebLogic Server Application Classloading” in Developing Applications With WebLogic Server.

 


Configuring Persistence

The following sections describe how to configure persistence.

Editing the Configuration Property Files

BEA Kodo uses two XML files, listed in the following table, to define configuration properties.

Table 6-1 Persistence Configuration Files 
Configuration File
Description
persistence.xml
Kodo configuration parameters defined by the JPA functional specifications. This file is required.
The XML schema for structuring this configuration is available at: http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd.
For more information, see “Chapter 6. Persistence” in the Kodo Developers Guide.
persistence-configuration.xml
Configuration parameters that are specific to BEA Kodo. This file is not required when deploying an application. If specified, you must still
Use of persistence
If you do not include persistence-configuration.xml in your deployment, WebLogic Server will create reasonable defaults for each configuration parameter.
The XML schema for structuring this configuration is available at: http://www.bea.com/ns/weblogic/persistence-configuration/10.0/persistence-configuration.xsd.

Note: The weblogic.jar file must be in the CLASSPATH when using the persistent-configuration.xml file in the Java SE environment.

Edit the contents of the configuration files as required to configure persistence. The files should be available as resources in the META-INF directory of the root of the persistence unit. For container environments, the root of a persistence unit may be one of the following:

Configuring a Plugin

Because Kodo is a highly customizable environment, many configuration properties relate to the creation and configuration of system plugins. Plugin properties have a syntax very similar to that of Java annotations. They allow you to specify both what class to use for the plugin and how to configure the public fields or bean properties of the instantiated plugin instance.

Essentially, plugins are defined via a series of properties using name/value pairs. The following example shows how a plugin is defined within persistence.xml:

<property name=’myplugin.DataCache’ value=’com.bea.MyDataCache(CacheSize=1000, RemoteHost=’CacheServer)’>

 


Deploying a Kodo Application

You are ready to deploy your application on WebLogic Server, once you have completed the following tasks:

Once your application is configured, a Kodo application is deployed just like any other application. For complete information on deploying applications, see Deploying Applications on BEA WebLogic Server.

 


Configuring a Kodo Application

Once you have deployed your Kodo application, you can alter the configuration paramters defined in persistence.xml and persistence-configuration.xml. Many Kodo configuration parameters can be configured from the WebLogic Server Administration Console.

If your deployed application has defined a persistence unit within persistence.xml, you can access configuration from within the Administration Console using the following:

  1. Select Deployments
  2. Select the name of the module containing a persistence unit that you want to configure.
  3. Select the Configuration tab.
  4. Select the Persistence tab.
  5. From the list of persistence units, select the one that you want to configure.

From here, you can access all of the Kodo persistence parameters that can be edited from the Administration Console.

Note: You cannot create a new persistence unit from the Administration Console. To create a new persistence unit, you must edit persistence.xml manually.

  Back to Top       Previous  Next