The Bean Provider must define the entity bean class as an ABSTRACT class.
The container provides the implementation class that is used at RUNTIME.
The container-managed persistent fields and container-managed relationship
fields MUST NOT be defined in the entity bean class. From the perspective
of the Bean Provider, the container-managed persistent (CMP) fields and
container-managed relationship (CMR) fields are VIRTUAL fields only, and are
accessed through get and set accessor methods. The IMPLEMENTATION of the
container-managed persistent fields and container-managed relationship
fields is supplied by the Container.
The container-managed persistent (CMP) fields and container-managed relationship (CMR)
fields MUST be specified in the deployment descriptor (DD) using the
cmp-field and cmr-field elements
respectively. The names of these fields MUST be valid Java identifiers and must
begin with a LOWERCASE letter.
The Bean Provider MUST define the accessor methods for the
container-managed persistent fields and container-managed relationship
fields as get and set methods, using the JavaBeans conventions.
The IMPLEMENTATION of the accessor methods is supplied by the Container.
The accessor methods MUST be public,
MUST be abstract, and MUST bear the name of the
container-managed persistent field (cmp-field) or
container-managed relationship field (cmr-field)
that is specified in the deployment descriptor (DD), and in which the
first letter of the name of the cmp-field or
cmr-field has been UPPERCASED and prefixed
by “get” or “set”.
The accessor methods for a container-managed relationship (CMR) field MUST be
defined in terms of the LOCAL interface of the related entity bean.
The accessor methods for container-managed relationship fields for one-to-many or
many-to-many relationships MUST utilize one of the following Collection interfaces:
java.util.Collection or java.util.Set.
The Collection interfaces used in relationships are specified in the deployment
descriptor. The IMPLEMENTATION of the collection classes used for the
container-managed relationship fields is supplied by the Container.
An entity bean local interface type (or a collection of such) CAN be the type of
a cmr-field. An entity bean local interface type (or a collection of such)
CAN NOT be the type of a cmp-field.
The accessor methods for the container-managed relationship fields
MUST NOT be exposed in the REMOTE interface of an entity bean.
The LOCAL interface types of the entity bean and of related entity beans MUST NOT
be exposed through the REMOTE interface of the entity bean.
The collection classes that are used for container-managed relationships
MUST NOT be exposed through the REMOTE interface of the entity bean.
Once the primary key for an entity bean has been set, the Bean Provider MUST NOT
attempt to change it by use of set accessor methods on the primary key cmp-fields.
The Bean Provider SHOULD therefore NOT expose the SET accessor methods for
the primary key cmp-fields in the component interface of the entity bean.
The Bean Provider MUST ensure that the Java types assigned to the cmp-fields
are restricted to the following: Java primitive types and Java serializable types.