user manual
Chapter 14: Entity Beans and CMP 1.1 in Borland Enterprise Server 133
Implementing an entity bean
methods that correspond to those declared in the remote or local and home
interfaces.
Packaging Requirements
Like session beans, entity beans can expose their methods with their
interfaces. Each Entity Bean must also have corresponding entries in its JAR's
deployment descriptors. The standard deployment descriptor, ejb-jar.xml
contains essentially three different types of deployment information. These
are:
1 General Bean Information: This corresponds to the <enterprise-beans>
elements found in the descriptor file and is used for all three types of beans.
This information also includes information on the bean's interfaces and
class, security information, environmental information, and even query
declarations.
2 Relationships: This corresponds to the <relationships> elements found in
the descriptor file and applies to entity beans using CMP only. This is where
container-managed relationships are spelled out.
3 Assembly Information: This corresponds to the <assembly-descriptor>
element which explains how the beans interact with the application as a
whole. Assembly information is broken down into four categories:
■
Security Roles: simple definitions of security roles used by the
application. Any security role references you defined for your beans
must also be defined here.
■
Method Permissions: each method of each bean can have certain rules
about their execution. These are set here.
■
Container-Transactions: this specifies the transaction attributes as per
the EJB 2.0 specification for each method participating in a transaction
■
Exclude List: methods to be uncalled by anyone
All of these can be accessed through the Deployment Descriptor Editor. You
should refer to the EJB 2.0 specification for DTD information and the proper
use of the descriptor files.
Entity Bean Primary Keys
Each Entity Bean must have a unique primary key that used to identify the
bean instance. The primary key can be represented by a Java class that must
be a legal value type in RMI-IIOP. Therefore, it extends the
java.io.Serializable interface. It must also provide an implementation of the
Object.equals(Object other) and Object.hashCode() methods.
Normally, the primary key fields of entity beans must be set in the ejbCreate()
method. The fields are then used to insert a new record into the database.
This can be a difficult procedure, however, bloating the method, and many
databases now have built-in mechanisms for providing appropriate primary










