Implement mechanisms which support loose coupling between clients and components

Access beans

EJB access beans can greatly simplify client access to enterprise beans and alleviate the performance problems associated with remote calls for multiple enterprise bean attributes.

Access beans are Java bean representations of enterprise beans. They are typically used in client programs that employ JavaServer Pages (JSP) files, servlets, or enterprise beans that interface with other enterprise beans. Access beans shield you from the complexities of managing enterprise bean lifecycles. This means that you can program to enterprise beans as easily as you can program to Java beans, which greatly simplifies your enterprise bean client programs and helps reduce your overall development time.

To understand how access beans solve the problem of performance degradation in client-to-enterprise bean interactions, it is helpful to review how a client program typically accesses an enterprise bean:

  1. Client obtains a context to the name server (name service context).

  2. Client looks up the home of the enterprise bean using the name service context.

  3. Client creates an enterprise bean instance from the enterprise bean home, which returns an enterprise bean proxy object.

  4. Client accesses the remote methods of the enterprise bean instance through an enterprise bean proxy object using a remote call.

Since each client call to an enterprise bean proxy object is a remote call, performance declines if an enterprise bean has numerous attributes and multiple remote calls are made to set or get the attributes. Access beans solve the performance problem by simply caching server-side data, such as entity data, on the client side. A local cache of enterprise bean attributes significantly improves access speed to an enterprise bean.

There are four types of access beans in WebSphere Studio:

Java bean wrapper and copy helper access beans in WebSphere Studio are similar to the Java bean wrapper and copy helper access beans used in VisualAge for Java. (Note, however, that in WebSphere Studio there is no support for the rowset access beans used in VisualAge for Java.)

NOTE: Data access beans and copy helper beans cannot be created for session beans. Only Java wrapper access beans can be created for session beans. This not a limitation, this is by design. All access bean types can be created for entity beans.

By comparison, EJB factories and data classes are new types of access beans that are specific to Application Developer. Since EJB factories are like Java bean wrappers and data classes are like copy helpers, they can replace the function provided by Java bean wrappers and copy helpers. However, unlike the relationship between copy helpers and Java bean wrappers, data classes are not a superset of EJB factories.

The new technology that underlies EJB factory and data class access beans simplifies the process of creating or editing access beans. You can use the Create an Access Bean wizard or the Edit an Access Bean wizard to easily create or edit data class access beans. If you have an existing application that employs access beans that were created in VisualAge for Java, you can use the wizards to create or edit Java bean wrapper or copy helper access beans. However, if you are developing a new application in WebSphere Studio, it is recommended that you create only data class access beans, which employ the new technology. EJB factories are automatically created by the Create an Access Bean wizard regardless of whether you choose to create a data class, Java bean wrapper, or copy helper. For this reason, EJB factories do not appear on the selection page of the Create an Access Bean wizard, where you specify the type of access bean that you want to create.

Professional hosting     Belorussian informational portal         Free SCBCD 1.3 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     Free SCJP 5.0 (Tiger) Study Guide     Free Mock Exam Engine     Free SCWCD 1.4 Study Guide