Getting Started Samples: Enterprise JavaBeans

This sample demonstrates a basic application that shows how a session and entity bean are used to model a simplified sign on procedure. Instead of running this finished sample, you can create this application by running the tutorial Getting Started: Enterprise JavaBeans.

The sample application allows a user to enter his/her name, and returns a greeting based on the number of times the user has entered this name before. The application contains the following components:

Concepts Demonstrated by this Sample

Location of Sample Files

This sample is located at:

BEA_HOME\weblogic81\samples\platform\GettingStarted_EJB_Sample\GettingStarted_EJB_Sample.work

To Run the Sample

  1. Start WebLogic Server in the workshop domain.
  2. Open MyTestProject_Sample\helloControl\HelloBeanCtrlTest.jws and click the Start button.
  3. Enter your name in the String field and click the hello button.
  4. Scroll down to the Service Response section, and notice that the response is Hello, <your name>!

    In the preceding two steps the web service invoked the hello method on the Hello bean via the EJB control. The Hello bean invoked the findByPrimary method of the Visit bean to find out if your name is stored in the database. Because you are running this test for the first time, your name could not be found. A record with your name was created in the database and the Hello bean sent the appropriate response.
  5. Click the Test Operations link.
  6. Enter your name again, click the hello button, and notice that the response is Hello again, <your name>!

    In this step the Hello bean again invoked the findByPrimary method of the Visit bean to find out if your name is stored in the database. Your name was found, the database record was updated to reflect that this was your second visit, and the Hello bean sent the appropriate response.
  7. Click the Test Operations link, enter your name again, click the hello button, and notice that the response is Hello <your name>! This is visit number 3.
  8. Repeat the test with a different name and observe the outcome.
  9. Return to WebLogic Workshop and press the Stop button to close the Test Browser.

Related Topics

Tutorial: Enterprise JavaBeans