254
pluggable resource adapters and may be packaged as J2EE Connector resource
adapters.
6.2.1.2
EJB Container Managed Persistence
Container managed persistence (CMP), which is a resource manager independent
data access API for entity beans, has been expanded and enhanced in the J2EE 1.4
platform. CMP technology enables applications to be easily integrated with various
databases or resource managers, plus it enhances portability.
CMP shields the developer from the details of the underlying data store. The
developer does not need to know how to persist or retrieve data to or from a par
ticular data store, since the EJB container handles these tasks. Instead, the devel
oper need only indicate what data or state needs to be stored persistently.
In addition, a developer uses the same API that is, the EJB CMP methods
regardless of the underlying type of resource manager. The same entity bean can
thus be used with any type of resource manager or database schema. The technol
ogy makes it possible to develop enterprise beans that can be customized at
deployment to work with existing data. That is, the same bean implementation can
be deployed to work with many different customer data schemes. The mapping
done at deployment may vary for each customer set up, but the bean itself is the
same. Since the EJB container generates suitable data access code for each situa
tion, the bean developer does not have to know or care about the underlying
resource manager specific code. Furthermore, since it has complete control over
managing persistence, the container can optimize database access for better per
formance.
The J2EE 1.4 platform includes the most up to date EJB specification and
CMP technology. Rather than declaring persistent variables in a bean's implemen
tation, developers include abstract get and set accessor methods for persistent
variables. Persistent variables are thus treated similarly to JavaBeans properties.
Developers do not provide an implementation for these accessor methods since
they are abstract methods; instead, the EJB container provides the method imple
mentations.
The CMP architecture also includes container managed relationships, which
allows multiple entity beans to have relationships among themselves. Container
managed relationships are handled in much the same way as container managed
persistence. The bean implementation merely provides get and set accessor
methods for these fields, and the container provides the method implementations.
Similarly, the developer specifies the relationships in the deployment descriptor.
<
New Page 1
Clan Web Hosting