Web hosting isp - Creating the entity beans Components for the server

Creating the entity beans Components for the server The two components on the EJB page of the component palette that are used by the session bean deployed on the server are the EntityBeanProvider and EntityBeanResolver components. EntityBeanProvider provides data from the entity beans deployed on the server, and EntityBeanResolver resolves data to those entity beans. You add these components to the session bean you create to make the session bean capable of providing from and resolving to the entity beans. If you are creating enterprise beans that run in an EJB 1.x container, you should continue using the EntityBeanProvider and EntityBeanResolver components. If your beans are going to be running in an EJB 2.0 container, you should use the LocalEntityBeanProvider and LocalEntityBeanResolver components instead. These components have an ejbLocalHome property instead of an ejbHome property. They also have an ejbLocal property, which takes the class of the entity bean s interface that implements EJBLocalObject. All the events and listeners in the EntityBeanProvider and EntityBeanResolver components have corresponding local versions in LocalEntityBeanProvider and LocalEntityBeanResolver. Components for the client Two of the components on the EJB page are used in the client side: EjbClientDataSet and SessionBeanConnection. The EjbClientDataSet provides data from and resolves changes to the session bean referenced in the SessionBeanConnection. A SessionBeanConnection holds the reference to a session bean on the server, and it contains the method names to provide datasets from and resolve datasets to that session bean. Creating the entity beans Begin by using the EJB 1.x Entity Modeler or the EJB designer to create the entity beans that access the data you are interested in. The sample project creates Employee and Department entity beans, although this chapter refers only to Employee. For information about creating EJB 1.x entity beans using the EJB 1.x Entity Bean Modeler, see Chapter 9, Creating EJB 1.x entity beans from an existing database table. For information about creating EJB 2.0 or 1.1 entity beans with the EJB designer, see Chapter 6, Creating entity beans with the EJB designer. Creating the server-side session bean Create the session bean that will live on the server. Consider using the Enterprise JavaBean 1.x wizard or the EJB designer to create a stateless session bean. Later in the next section you ll be adding EntityBeanProvider and EntityBeanResolver classes to this bean. Because these classes aren t serializable, it s easier to place them in a stateless session bean, which, for Borland application servers, is never passivated. If you require a stateful session bean for your application, you should either have the stateful session bean refer to a stateless session bean, or you must reinstantiate the EntityBeanProvider and EntityBeanResolver when the stateful session bean is activated. Here is what a resulting bean class named PersonnelBean would look like: public class PersonnelBean implements SessionBean { private SessionContext sessionContext; public void ejbCreate() { } public void ejbRemove() throws RemoteException { } 142 Developing Applications with Enterprise JavaBeans
Would you like to be a member of headache free web site owner’s community. Now you can. We focus in IX Web Hosting, go go go!


Leave a Reply