Java Reference
In-Depth Information
The bean class is responsible for implementing the methods in the remote
interface. It doesn't actually extend the remote interface, though the method
signatures must match. This bean concentrates on specifics of the model logic.
With the primary key class , we specify an entity bean's primary database key.
This is a simple class that defines the set of fields that in turn will uniquely define
the rows in our database. We also have the usual responsibilities of supporting a
generic object, including comparison, hash codes, and equality for the class.
As we mentioned, the container supports many of the management ser-
vices of an EJB , so we probably won't see methods to handle such services as
security, transactions, context, naming, or even distribution. While we don't
have to develop those services, we do need to configure them through a
deployment descriptor . These files use XML to describe how an EJB is to be
deployed. They allow us to delay binding of the container's services until run-
time. A deployment descriptor's format is specific to each classification of
enterprise bean, since each major category will need subtly different informa-
tion. Each bean class has its own deployment descriptor, which can be gener-
ated manually or automatically through the development environment or
proprietary framework. I've used both approaches, and either will work rea-
sonably well.
We have seen all of the basic pieces of an EJB application. Table 8.1 shows
each piece, with the corresponding Java interfaces that are implemented and
the role that each plays. Next, we'll implement our bulletin board example
with EJB s. At that point, we'll be free to dive into the antipatterns that plague
EJB applications.
Table 8.1 Here are the parts of an EJB program: the common name of the artifact; the formal
construct used to build the program; the Java interface that is extended; and the role that the
construct plays in EJB development.
Program artifact
Construct
Extends
Role
Remote interface
Java interface
javax.ejb.EJBObject
Defines the business meth-
ods and attributes.
Home interface
Java interface
javax.ejb.EJBHome
Defines life cycle methods.
Bean class
Java class
javax.ejb.EntityBean
Implements remote interface
methods.
Primary key
Java class
Serializeable
Identifies the database key.
Deployment
descriptor
XML file
N/A
Defines properties of ser-
vices used by the bean.
Search WWH ::




Custom Search