user manual
132 BES Developer’s Guide
Container-managed persistence and Relationships
jar.xml descriptor is fully-documented at the Sun Java Center. The DTD for
ejb-borland.xml is reproduced in this document and its usage documented
here. The Borland proprietary descriptor contains 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 database access
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 for which they must generate database access
calls. 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 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.
The EJB 2.0 specification allows entity beans that use container-managed
persistence to also have container-managed relationships among themselves.
The container automatically manages bean relationships and maintain the
referential integrity of these relationships. This differs from the EJB 1.1
specification, which only allowed you to expose a bean's instance state
through its remote interface.
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.
Implementing an entity bean
Implementing an entity bean follows the rules defined in the EJB 1.1 and 2.0
specifications. You must implement a home interface, a remote interface or a
local interface (if using the 2.0 container-managed persistence), and the entity
bean implementation class. The entity bean class must implement the










