Chapter 8. Entity Bean Application Example

This chapter uses an example of a distributed application to illustrate how enterprise applications use entity beans to model business entities. The example application uses entity beans to store the persistent state of the enterprise application. The chapter also shows how organizations develop the respective components of the application and how, ultimately, the customer deploys the entire application. The example application illustrates

  • The implementation of several entity beans to highlight the various issues in managing persistence. Entity beans use various styles to implement their persistence; thus, we illustrate the use of both CMP and BMP. We focus on the CMP programming model defined in the EJB 2.0 and 2.1 specifications. The example shows how to construct an abstract schema consisting of multiple entity beans related through their local interfaces, using container-managed relationships.

  • The use of local interfaces to develop lightweight entity beans. The example contains several entity beans that have local interfaces. Local interfaces allow clients to access the entity beans in an efficient manner and also avoid the complexities of programming distributed objects.

  • The use of EJB QL to develop portable queries on the application's persistent state. The example illustrates the use of EJB QL queries for find methods that can be directly invoked from clients, as well as for select methods, which are used internally by the bean.

  • The use of home business methods. We show how home business methods are used to model aggregate operations that do not operate on a specific entity bean instance.

  • The techniques for developing applications for different customers with different operational environments. An ISV would like to sell the application to as broad a range of customers and operational environments as possible. Our example illustrates how the ISV (1) uses entity beans with CMP to integrate its application with the customer's existing applications and database and (2) uses remote interfaces to allow flexibility in the deployment of the application with respect to client applications.

  • The design issues for remote interfaces. The developer should design the remote interface so that its methods take into account the costs of distribution.

  • The techniques for caching an entity object's persistent state. The example illustrates how to use the instance variables of an entity bean class, along with the ejbLoad and ejbStore methods, to cache the entity object's persistent state.

  • The correct approach that a client application, such as EnrollmentBean, takes to use the entity bean client-view API.

  • The techniques for "subclassing" an entity bean with CMP to create an entity bean with BMP. The subclass implements the data access methods.

  • The packaging of enterprise beans into J2EE standard files. The example illustrates the packaging of enterprise beans and their dependent parts into the standard ejb-jar file and the J2EE enterprise application archive file (.ear file).

  • The parts of an application that do not have to be developed. The example code is also interesting in what it does not include namely, database access code in the CMP entity beans and no transaction or security management related code. The deployment descriptors describe declaratively the transaction and security requirements for entity beans. Transaction management is described in Chapter 10, Understanding Transactions; security management, in Chapter 11, Managing Security.

This chapter begins with the description of the problem. Then, to give you a feel for the scope of the application, the application components are described from a high level, followed by detailed information on each part of the application, from the perspective of the vendor that developed the part.



Applying Enterprise Javabeans
Applying Enterprise JavaBeans(TM): Component-Based Development for the J2EE(TM) Platform
ISBN: 0201702673
EAN: 2147483647
Year: 2003
Pages: 110

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net