When you deploy an EJB 1.1 CMP entity bean, you must identify which fields in the entity will be managed by the container and how they map to the database. The container then automatically generates the logic necessary to save the bean instance’s state.
Fields that are mapped to the database are called container-managed fields—EJB 1.1 doesn’t support relationship fields, as EJB 2.0 does. Container-managed fields can be any Java primitive type or serializable object. Most beans use Java primitive types when persisting to a relational database, since it’s easier to map Java primitives to relational data types.
EJB 1.1 also allows references to other beans to be container-managed
fields. For this to work, the EJB vendor must support converting bean
references (remote or home interface types) from remote references to
something that can be persisted in the database and converted back to
a remote reference automatically. Vendors will normally convert
remote references to primary keys,
HomeHandle objects, or some other proprietary
pointer type that can be used to preserve the bean reference in the
database. The container will manage this conversion from remote
reference to a persistent pointer and back automatically. This
feature was abandoned in EJB 2.0 CMP in favor of container-managed
The advantage of container-managed persistence is that the bean can be defined independently of the database used to store its state. Container-managed ...