BEA Systems Logo Banner Arc  
  Oracle Sequence Sample


Oracle Sequence Sample

This sample demonstrates creating unique identication numbers using EJBs. You could use these techniques when you create entity beans, which require a unique primary key. This sample uses a container-managed persistence (CMP) based entity bean with a JDBC connection pool to demonstrate the use of the Oracle database's sequence procedure to create unique primary keys. This sample depends on system tables that are shipped with Oracle.

This sample shows:

Main Directory Location

The following directory contains the Java source files and XML based deployment descriptors:

Windows NT:

$TUXDIR\samples\j2ee\ejb\sequence\oracle

UNIX:

$TUXDIR/samples/j2ee/ejb/sequence/oracle

A common build script is provided for all the EJB samples and it can be found in the following directory:

Windows NT:

$TUXDIR\samples\j2ee\ejb 

Unix:

$TUXDIR/samples/j2ee/ejb 

Files

The following table lists and describes all the files for this sample application:

File Description

ejb-jar.xml

The deployment descriptor file used to add the bean to the EJB container

weblogic-ejb-extensions.xml

A file containing the WLE extensions to the deployment descriptor DTD

Client.Java

The Java source code for the client

OracleBean.java

The Java source code for the entity bean that uses container-managed persistence. This class contains the business logic method implementations and methods required by EJB 1.1 specification.

Oracle.java

The Java source code for the Remote interface of the OracleBean class

OracleHome.java

The Java source code for the Home interface of the OracleBean class

OraclePK.java

Primary key for the bean

ProcessingErrorException.java

Application-specific exception thrown by the OracleBean class for business methods

sequence.sql

SQL statements to create a sequence in an Oracle database

Utility Files

The following table lists and describes the utility files for this sample application. These files are generated based on the WLE installation environment. Since a common build script is provided for all the EJB samples, the instructions to build and execute the samples are provided later in Building and Running the EJB Samples. The following files generated in the same directory as where the source files are found.

File Description

runme.cmd

The Windows NT batch file that contains commands to set the environment, boot the server, and execute the client for this sample

runme.ksh

The UNIX Korn shell script that contains commands to boot the server and execute the client for this sample

run_client.cmd

The batch file to run the client on Windows NT systems

run_client.ksh

The script file to run the client only on UNIX systems

setenv.cmd

The batch file to set the necessary environment variables on Windows NT systems

setenv.ksh

The script file to set the necessary environment variables on UNIX systems

ubbconfig

The WLE server configuration file to be used on UNIX systems

ubbconfig.nt

The WLE server configuration file to be used on Windows NT systems

ejb_sequence_oracle.jar

The ejb-jar file that contains the source file classes, the container-specific class files generated by the ejbc command, and the deployment descriptor files. This is the ejb-jar file that is deployed on the WLE server.

Building and Running the Sample Application

Before you build and run the Oracle sequence sample, make sure you do the following:

  1. Create a file named sequence.sql that contains a sample sequence for your database. The sequence must include one or more appropriate SQL statements, such as the following:

                    "create sequence ejbSequence start with 8001"
    
  2. Edit the weblogic-ejb-extensions.xml file to indicate the appropriate database information. The locations within the weblogic-ejb-extensions.xml file that you need to edit are identified by the following comments:

             *** DATABASE INFORMATION SPECIFIC TO INSTALLATION SITE ***
    

    The values you need to provide are for the database URL, user, and password.

See the topic Building and Running the EJB Sample Applications for additional information about how to build and run the Oracle sequence bean sample application.

Javadoc

The javadoc for the Oracle sequence sample is available at the following location:

Package samples.j2ee.ejb.sequence.oracle

 
 
    BEA Home | Corporate Info | News | Solutions | Products | Partners | Services | Events | Download | How to Buy
 Copyright © 1999, BEA Systems, Inc. All rights reserved.
 Contact BEAdocsupport@beasys.com