Step 3: Running and Testing the Application

Previous topic
Previous
Next topic
Next

As you have done before, the next step is to run the application and test it with a generated client.

To run the application:

Your sample client will specify a new department called tutorial, with the department number 19 and a location of 1000.

To create and run a sample client:

  1. In the Navigator, right click on your session bean (hrApp) and choose New Sample Java Client.
  2. In the Sample EJB Java Client Details dialog, accept the default option for Connect to OC4J Embedded in JDeveloper and click OK.
    A new file, hrAppClient3.java appears in the Navigator and opens in the Code Editor.
  3. Call the new create method with the following code:
    HrApp.addDepartment( new Long(19L), "tutorial", new Long(1000L) );
    System.out.println("added department");
  4. Run the application by selecting Run | Run hrAppClient3.java
  5. You should see "added department" in the Log Window.
    Note: If you get a DuplicateKeyException error after running this, then department number 19 already exists. In the code above, change the number of the new department to something unique.
  6. Finally, to see that your new department has been added to the list of departments, run hrAppClient1.java again.