- Aug 16, 2002
2.5 Key Point Summary
This chapter introduced the J2EE architecture, J2EE components, and presents an overview of enterprise beans. You learned the basic concepts behind enterprise beans and how the container manages different beans in the J2EE architecture. You also learned how an enterprise bean might be used in a distributed architecture.
Here are the key points from this chapter.
The J2EE platform gives you a multitiered application model to develop distributed components.
A three-tier architecture places web components and business components in the middle tier. The presentation tier contains client applications and the database tier contains database programs.
The J2EE components consist of technologies like enterprise beans, servlets, and JSP. They also contain APIs that are valuable to EJBs, such as JNDI, JDBC, and JMS.
Remote Method Invocation (RMI) provides support for network calls used by enterprise beans in the J2EE architecture.
The J2EE application server has containers that provide services to enterprise beans and web components.
A deployment descriptor is an XML file that describes how the container will configure an EJB to run on a J2EE application server.
The containers in the J2EE architecture manage many services, such as EJB and servlet life cycles, database connection pooling, security, transaction management, and data persistence.
Enterprise beans are server-side components that encapsulate business logic and business data.
The EJB container provides system-level services to each bean deployed in a J2EE application server. These services include transaction management, resource pooling, security, and multithreading control.
There are three types of enterprise beans: session beans, entity beans, and message-driven beans. Session beans may be stateless or stateful, and entity beans may use bean-managed persistence or container-managed persistence.
Stateless session beans do not store client-specific data in their instance variables. Stateless session beans are scalable and can be shared by many clients.
Stateful session beans do store client-specific data in their instance variables. Stateless session beans store the conversational state between a client and a bean. The EJB container may passivate or activate stateful session beans by moving the bean between memory and secondary storage.
Stateless session beans are appropriate for general tasks that do not apply to a specific client. Stateful session beans apply to situations where a bean must remember nonpersistent client information between method invocations.
Entity beans are in-memory business objects that correspond to data in persistent storage.
Entity beans with bean-managed persistence contain SQL calls to read and write to a database.
Entity beans with container-managed persistence do not contain code for database access. The container generates the necessary database calls for you.
An entity bean's abstract schema defines a bean's persistent fields and its relationships with other entity beans.
A bean's relationship to another bean is stored as a relationship field. The container uses relationship fields to identify related beans.
Message beans allow J2EE applications to receive messages asynchronously. Message beans use the Java Message Service (JMS) to handle messaging.
Message beans are highly scalable, similar to stateless session beans.
The home or local home interface of an enterprise bean defines life cycle methods. The local or remote interface contains the business methods.
Local interfaces allow enterprise beans to call methods locally, which performs better than remote calls across a network.