Access beans
WebSphere Commerce commands interact with access beans rather than directly with entity beans. EJB access beans can greatly simplify client access to enterprise beans and alleviate the performance problems that are associated with remote calls for multiple enterprise bean attributes.
Access beans are Java™ bean representations of enterprise beans. In WebSphere Commerce, access beans are used in Controller commands and Task commands. 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. This greatly simplifies your enterprise bean client programs and helps reduce your overall development time.
- Client obtains a context to the name server (name service context).
- Client looks up the home of the enterprise bean with the name service context.
- Client creates an enterprise bean instance from the enterprise bean home, which returns an enterprise bean proxy object.
- Client accesses the remote methods of the enterprise bean instance through an enterprise bean proxy object with a remote call.
In most cases, a program that uses enterprise beans must deal with the Java Naming and Directory Interface (JNDI) as well as the home and remote interfaces of enterprise beans. To simplify the programming model, an access bean for each enterprise bean is generated. There are three types of access beans: Data class, Copy helper, and bean wrapper. We use the Copy helper for Entity beans and we use the Java bean wrapper for Session beans. When you create your own enterprise beans, you can use WebSphere Commerce Developer to generate this access bean.
The following diagram displays the interaction between commands, access beans, entity beans, and the database.