As you have done before, the next step is to run the application and test it
with a generated client.
To run the application:
- In the Navigator, right-click your session bean (hrApp)
and choose Run hrApp from the context menu.
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:
- In the Navigator, right click on your session bean (hrApp)
and choose New Sample Java Client.
- 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.
- Call the new create method with the following code:
HrApp.addDepartment( new Long(19L), "tutorial", new Long(1000L) );
System.out.println("added department");
- Run the application by selecting Run | Run
hrAppClient3.java
- 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.
- Finally, to see that your new department has been added to the list of departments,
run hrAppClient1.java again.