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 life-cycles. 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 that you can develop in the workbench:

Java bean wrapper and copy helper access beans developed in the workbench are similar to the Java bean wrapper and copy helper access beans used in VisualAge for Java. (Note, however, that in the workbench 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, 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.

EJB access beans and client applications
Before you use EJB access beans in your client applications, you should have an understanding of how access beans work and the differences that exist between the various types of access beans.

Java bean wrappers (access beans)
Java bean wrapper access beans allow either a session or entity bean to be used like a standard Java bean.

Copy helpers (access beans)
A copy helper access bean has the same basic characteristics as a Java bean wrapper, but introduces some additional characteristics of its own.

EJB factories (access beans)
An EJB factory is an access bean that simplifies the creating or finding of an enterprise bean instance.

Data classes (access beans)
A data class is an access bean that is similar to a copy helper access bean, but it employs a different technology.

Programming model for JSP files and servlets (access beans)
An entity EJB can contain a large number of attributes. In most situations, these attributes are used by a JSP program to create an HTML output page.

 

Parent topic

Creating EJB access beans

 

Related concepts

Programming model for JSP files and servlets (access beans)
EJB access beans in your client applications, you should have an understanding of how access beans work and the differences that exist between the various types of access beans.">EJB access beans and client applications

 

Related tasks

Creating EJB access beans

Related reference
Example: Using access beans