Web design service - Reservation EJB, and many others. Each of these
Reservation EJB, and many others. Each of these business concepts represents data that needs to be tracked and possibly manipulated. Entities really represent data in the database, so changes to an entity bean result in changes to the database. There are many advantages to using entity beans instead of accessing the database directly. Utilizing entity beans to objectify data provides programmers with a simpler mechanism for accessing and changing data. It is much easier, for example, to change a customer s name by calling Customer.setName()than to execute an SQL command against the database. In addition, objectifying the data using entity beans also provides for more software reuse. Once an entity bean has been defined, its definition can be used throughout Titan s system in a consistent manner. The concept of customer, for example, is used in many areas of Titan s business, including booking, scheduling, and marketing. A Customer EJB provides Titan with one complete way of accessing customer information, and thus it ensures that access to the information is consistent and simple. Representing data as entity beans makes development easier and more cost effective. When a new EJB is created, a new record must be inserted into the database and a bean instance must be associated with that data. As the EJB is used and its state changes, these changes must be synchronized with the data in the database: entries must be inserted, updated, and removed. The process of coordinating the data represented by a bean instance with the database is called persistence. There are two basic types of entity beans, and they are distinguished by how they manage persistence. Container-managed persistence beans have their persistence automatically managed by the EJB container. The container knows how a bean instance s persistent fields and relationships map to the database and automatically takes care of inserting, updating, and deleting the data associated with entities in the database. Entity beans using bean-managed persistence do all this work explicitly: the bean developer must write the code to manipulate the database. The EJB container tells the bean instance when it is safe to insert, update, and delete its data from the database, but it provides no other help. The bean instance does all the persistence work itself. Bean-managed persistence is covered in Chapter 10. Container-managed persistence has undergone a dramatic change in EJB 2.0, which is so different that it s not backward compatible with EJB 1.1. For that reason, EJB 2.0 vendors must support both EJB 2.0 s container-managed persistence model and EJB 1.1 container-managed persistence model. The EJB 1.1 model is supported purely so that application developers can migrate their existing applications to the new EJB 2.0 platform as painlessly as possible. It s expected that all new entity beans and new applications will use the EJB 2.0 container-managed persistence and not EJB 1.1 version. Although EJB 1.1 container-managed persistence is covered in this book, it should be avoided Copyright (c) 2001 O’Reilly & Associates
MySQL web hosting will be off your worry about list if you sign up with us,just trust us and go check MySQL Web Hosting services.