
EJB
™
Development Using Borland
®
JBuilder
®
8 and BEA WebLogic Server
™
7.0
35
If WebLogic is not running within JBuilder, start it by clicking Run Project icon-> Start
WeLogic 7.0. For deploying the EJBModule TestEntMod.jar, right-click TestEntMod.jar
from project tree. Click Deploy Options for TestEntMod.jar. Click Deploy.
Now WebLogic Application Server 7.x Enterprise Deployer tab opens in JBuilder message
pane showing the deployment status. Make sure that there are no deployment errors.
Test the entity bean
To test the entity bean Employee, create a test client to call the session bean EmployeeSes
which in turn calls the entity bean Employee. The entity bean Employee gets the data from the
database, sends to the session bean and the session bean sends the data to the test client. Refer
to the previous section Test the session bean in the chapter Working with session beans to get
help on how to create a test client.
For this exercise, the name of the test client is EmployeeSesTestClient and the package name
for this test client is com.borland.demo.ejb. JBuilder automatically creates a runtime
configuration called EmployeeSesTestClient for running the test client within JBuilder.
Modify the main() method of the test client EmployeeSesTestClient.java as follows:
public static void main(String[] args) {
EmployeeSesTestClient client = new EmployeeSesTestClient();
try {
client.create();
String empName = client.getEmpName(new Short("4"));
System.out.println("Employee Name from the Test Client is = " +
empName);
}catch (Exception ex) { ex.printStackTrace(); }
}
Comentários a estes Manuais