BEA Systems Logo Banner Arc  
  JDBC Sequence Sample


JDBC Sequence Sample

This sample demonstrates creating unique identification numbers using EJBs. You can use these techniques when you create an entity bean that requires a unique primary key. This sample uses a container-managed persistence based entity bean with a JDBC connection pool to show using a database table to create unique keys. The table and ranges for the keys are defined in the deployment descriptor.

Main Directory Location

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

Windows NT:

$TUXDIR\samples\j2ee\ejb\sequence\jdbc 

UNIX:

$TUXDIR/samples/j2ee/ejb/sequence/jdbc 

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 XML deployment descriptor file used to add the bean to the EJB container

weblogic-ejb-extensions.xml

The file containing the WLE extensions to the deployment descriptor DTD

Client.Java

The Java source code for the client

AutoAccountBean.java

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

AutoAccount.java

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

AutoAccountHome.java

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

AutoAccountPK.java

The primary key for the EJB

ProcessingErrorException.java

Application-specific exception thrown by the AutoAccountBean class for business methods.

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. Because a common build script is provided for all the EJB samples, instructions to build and execute the samples are provided later in Building and Running the EJB Sample Applications. 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_jdbc.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

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

  1. Create the table in your database using SQL statements such as the following:

                    "create table ejbAccounts (id varchar(15), bal float, type varchar(15))"
                    "create table idGenerator (tablename varchar(32), maxKey int)"
    
  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 JDBC sequence bean sample application.

Javadoc

The javadoc for the JDBC bean sample is available at the following location:

Package samples.j2ee.ejb.sequence.jdbc

 
 
    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