    All Examples

#

## Enterprise JavaBean examples

- Basic EJB examples
  - examples.ejb.basic.beanManaged
  - examples.ejb.basic.containerManaged
  - examples.ejb.basic.statefulSession
  - examples.ejb.basic.statelessSession

- Extensions examples
  - examples.ejb.extensions.readMostly

- Subclass example
  - examples.ejb.subclass

- Cluster examples
  - examples.cluster.ejb

- Jolt for WebLogic example
  - examples.jolt.ejb.bankapp

- WebLogic Enterprise Connectivity example
  - examples.wlec.ejb.simpapp

- Utilities examples
  - examples.ejb.utils.ListAll

# quick guide to the examples

If you're interested in... | ...then look at these examples:
Entity EJBs | examples.ejb.basic.beanManaged examples.ejb.basic.containerManaged examples.ejb.extensions.readMostly
The WebLogic entity bean extension isModified | examples.ejb.basic.containerManaged
Finders and finder expressions | examples.ejb.basic.containerManaged
Session EJBs | examples.ejb.basic.statefulSession examples.ejb.basic.statelessSession examples.jolt.ejb.bankapp examples.ejb.subclass
Calling an EJB from another EJB | examples.cluster.ejb
Using inheritance in EJB code | examples.ejb.subclass
Calling an EJB from a servlet | examples.ejb.basic.beanManaged.Servlet
Using EJBs in WebLogic Clusters | examples.cluster.ejb
Calling a TUXEDO Server from an EJB using Jolt for WebLogic | examples.jolt.ejb.bankapp
Calling a CORBA object on a Weblogic Enterprise Server from an EJB | examples.wlec.ejb.simapp
Listing all the EJBs deployed on a Server | examples.ejb.utils.ListAll

# about these examples

These examples demonstrate different aspects of Enterprise JavaBeans. It's a good idea to run all of these examples before attempting to create your own Enterprise JavaBeans. They will show you the different steps involved.

The examples demonstrate:

- Package examples.ejb.basic.beanManaged
  - An entity EJB with bean-managed JDBC persistence; the code in the EJB directly accesses the data storage
  - Client examples include a single client and servlet

- Package examples.ejb.basic.containerManaged
  - An entity EJB with container-managed JDBC persistence; the code in the EJB never touches the data storage
  - Demonstration of using finder methods
  - Demonstration of the WebLogic is-modified-method-name extension to the EJB 1.1 specification for optimizing calls to the underlying datastore.

- Package examples.ejb.basic.statefulSession
  - A stateful session EJB

- Package examples.ejb.basic.statelessSession
  - A stateless session EJB

- Package examples.ejb.extensions.readMostly
  - EJB demonstrating the use of a read-mostly pattern.
  - Demonstration of read-only and read-write entity EJBs.

- Package examples.ejb.subclass
  - A stateless session EJB that demonstrates inheritance in EJB code

- Package examples.cluster.ejb
  - An EJB that demonstrates calling EJBs in WebLogic Clusters.

- Package examples.jolt.ejb.bankapp
  - A stateful session EJB that calls a TUXEDO Server using Jolt for WebLogic

- Package examples.wlec.ejb.simpapp
  - A stateless session EJB that accesses a CORBA object on a WebLogic Enterprise Server using WebLogic Enterprise Connectivity

- Package examples.ejb.utils.ListAll
  - A utility progrram that creates a list of all the EJBs deployed on a Server.

## Building and running the examples

1. Read the instructions for each example, found at the links above.

2. Set up your development environment as described in Setting your development environment.

3. Depending on the example, set up any special properties, such as database persistence.

4. Build each example, using the provided build scripts or make file. We've provided instructions on using the build scripts.

   Certain examples build .jar files that contain multiple beans:

   - Cluster example combines both the account and teller beans into one .jar

   Note that certain examples depend on other beans being built first:

   - the Cluster example requires that you build the Account EJB before you build the Teller EJB.

5. You can deploy each EJB in one of two ways:

   - Permanently deploy the bean by adding its .jar file to the weblogic.ejb.deploy registration in the weblogic.properties file, then
   - start the WebLogic Server.
   or
   - Start the WebLogic Server, then
   - use the hot deploy feature of the WebLogic Console to deploy the .jar file. The bean's deployment will only last for that session of the Server.
   - If you build an example EJB with the supplied build scripts and deploy it, you cannot run the build script again and redeploy the bean from the same .jar without getting an error. You need to build the bean to a new .jar file and redeploy from that second file.

   Note: If you're running under the Microsoft SDK for Java, you'll also need to add the path to the .jar to the CLASSPATH for your WebLogic Server.

6. Run the example following the instructions for the example.

# there's more

Read more about EJB in WebLogic Server EJB Design and Development.

Read more about EJB deployment in these Deployment Guides:

- Deploying EJBs in WebLogic Server
- Deploying EJBs with DeployerTool
- Using WebLogic Server hot deploy

Read more about building the EJB examples with our supplied scripts in Building Enterprise JavaBean examples.

Copyright © 1997-2000 BEA Systems, Inc. All rights reserved.

Last updated 03/22/2000