Cpanel web hosting - Creating the server-side session bean The resolver must
Creating the server-side session bean The resolver must call the method of an EntityBeanConnection class that resolves any updates to the entity beans. This is how resolveEmployee() should appear: public DataSetData[] resolveEmployee(DataSetData[] dataSetDataArray) { return EntityBeanConnection.saveChanges(dataSetDataArray, new DataSet[] {employeeDataSet}); } Next add these methods to the remote interface. The simplest way to do this is to use the EJB designer. In the bean representation in the EJB designer, click a new method you just added and in the method inspector that appears, select Remote or Local from the Interfaces drop-down list. Or you can use BeansExpress. With the bean source file open in the editor, click the Bean tab, click the Methods tab, and check the check boxes next to the names of the two methods you just added. You can now check your session bean s remote interface (or local interface for a 2.0 bean if that is the interface you chose to define the methods in) to verify that the two methods are now defined. If you chose to define the methods in the remote interface, this is how it would look: public interface Personnel extends EJBObject { public com.borland.dx.dataset.DataSetData[] providePersonnel(com.borland.dx.ejb.RowData[] parameterArray, com.borland.dx.ejb.RowData[] masterArray) throws RemoteException; public com.borland.dx.dataset.DataSetData[] resolvePersonnel(com.borland.dx.dataset.DataSetData[] dataSetDataArray) throws RemoteException; } Calling the finder method You must tell the EntityBeanProvider which entity beans to provide. To do this, add an event to the EntityBeanProvider: 1 While in the UI designer, select the EntityBeanProvider in the structure pane. 2 Click the Events tab of the Inspector and double-click the blank column next to the findEntityBeans event. A new event is added. Here is the resulting event: entityBeanProvider1.addEntityBeanFindListener(new com.borland.dx.ejb.EntityBeanFindListener() { public void findEntityBeans(EntityBeanFindEvent e) { entityBeanProvider1_findEntityBeans(e); } }); … void entityBeanProvider_findEntityBeans(EntityBeanFindEvent e) { } 3 To the new event handler, add a finder method to return the entity beans you want. Here the added code appears in bold: void entityBeanProvider_findEntityBeans(EntityBeanFindEvent e) { try { e.setEntityBeanCollection(employeeHome.findAll()); } catch (Exception ex) { throw new EJBException(ex); } } Chapter 14: Using the DataExpress for EJB components 145
Our unmatched NT experience allows us to provide the most reliable and affordable hosting for our customers, just check NT Web Hosting services.