Figure 10-26 Defining the JDBC data source for the EJB

10.3.3 Integrating the entity EJB with the Web tier

In order to integrate the Customer EJB that we have created, with our Web tier, we need to do the following:

1.Modify the CustomerXML (DOM) included in the Web tier, to reference the generated Customer EJB instead of the original Customer JavaBean.

2.Add a create method to the CustomerXML (DOM) to construct the entity bean using the CustomerFactory. The original code uses the JavaBean constructor to create a new Customer object. We cannot do that with the entity bean, so we use the EJB factory’s create method.

3.Modify the CustomerXSLServlet to allow storage and retrieval of customer data.

4.Modify the CustomerXSLServlet to invoke the create method we created.

Modifying CustomerXML

To make the CustomerXML (DOM) reference our Customer EJB, we first need to include the CustomerInfoEJB project, into the class path of the CustomerInfoWeb project.

1.Switch to the Web perspective.

2.Right-click on the CustomerInfoWeb project. Choose the project properties from the menu. Choose the Java Build Path, and in the Projects tab, select the check box next to the CustomerInfoEJB project, as in Figure 10-27 on page 251.

3.Click OK to save your changes to the project properties.

250 The XML Files: Development of XML/XSL Applications Using WebSphere Studio

Page 266
Image 266
IBM Version 5 manual Integrating the entity EJB with the Web tier, Modifying CustomerXML