user manual
150 BES Developer’s Guide
Container-managed persistence and Relationships
jar.xml descriptor is fully-documented in the J2EE 1.3 Specification. The DTD
for ejb-borland.xml is reproduced in this document and aspects of its usage
documented here. The Borland proprietary descriptor allows for the
configuration of a number of properties that can be set to optimize container
performance and manage the persistence of your entity beans.
Container-managed persistence and Relationships
Borland's EJB container provides tools that generate the persistence calls at
the time that the entity bean is deployed; that is, when the entity bean is
installed into a Partition. The tools use the deployment descriptors to
determine the instance fields which must be persisted. Instead of coding the
database access directly in the bean, the bean provider of a container-
managed entity bean must specify in the deployment descriptor those
instance fields for which the container tools must generate access calls. The
container has sophisticated deployment tools capable of mapping the fields of
an entity bean to its data source.
Container-managed persistence has many advantages over bean-managed
persistence. It is simpler to code because the bean provider does not have to
code the database access calls. Handling of persistence can also be changed
without having to modify and recompile the entity bean code. The Deployer or
Application Assembler can do this by modifying the deployment descriptor
when deploying the entity bean. Shifting the database access and persistence
handling to the container not only reduces the complexity of code in the bean,
it also reduces the scope of possible errors. The bean provider can focus on
debugging the business logic of the bean rather than the underlying system
issues.
Borland's Persistence Manager (PM) not only persists CMP fields but also
CMP relationships. The container manages bean relationships and maintains
the referential integrity of these relationships. Just as you defined container-
managed persistence fields in a bean's deployment descriptor, you can now
define container-managed relationship fields in the deployment descriptor.
The container supports relationships of various cardinalities, including one-to-
one, one-to-many, and many-to-many.
Packaging Requirements
Like session beans, entity beans can expose their methods with a remote
interface or with a local interface. The remote interface exposes the bean's
methods across the network to other, remote components. The local interface
exposes the bean's methods only to local clients; that is, clients located on the
same EJB container.
Entity beans that use EJB 2.0 container-managed persistence should use the
local model. That is, the entity bean's local interface extends the EJBLocalObject
interface. The bean's local home interface extends the EJBLocalHome interface.










