Java Reference
In-Depth Information
Board
Discussion
Post
1
0..*
1
0..*
boardName (PK)
discussionID (PK)
name
name (PK)
boardName (PK)
discussionID (PK)
postID (PK)
author
date
subject
text
Figure 8.3 This entity-relationship diagram shows the organization of our BBS. We have a board
that represents a collection of discussions around a central topic, containing discussions. We also
have discussions, representing a single discussion, containing posts. Our posts are an atomic
statement by a single author at a given time, on a given subject.
should have a good, consistent model for representing the user interface, even
when the rest of the design is lacking. This example will introduce a fully
object-oriented model on the server side. Figure 8.3 shows an entity-relation-
ship diagram describing our application.
A board is a logical discussion topic, and it will hold a list of discussions.
(Earlier examples used thread , the more common name for BBS discussions.
Unfortunately, thread is a reserved keyword in Java.) A discussion contains
one or more posts . A post is a composition by an author and is the leaf node of
our BBS . The entity-relationship ( ER ) diagram in figure 8.3 shows the rela-
tionships between the entities and is ideal for this type of modeling.
In the next step, we'll generate the interfaces for our BBS . We'll show an
initial attempt at refactoring. As usual, our design will fall short of our
expectations.
8.2.1
Elements of an EJB application
EJB applications have five different parts: the remote and home interfaces, the
bean and primary key classes, and the deployment descriptor.
The remote interface is the primary interface of an EJB , and is the interface
that we'd define in a modeling tool. This is where we specify the business
attributes and methods of a given EJB . Because the container manages most of
the details, such as security, persistence, and context, we are free to focus on
the interface. The remote interface is a formal Java interface, meaning we
won't specify an implementation here. The home interface describes the object
known as the EJB Home and is similar to a description of a factory object. We
define methods to manage the bean's life cycle, such as creating and adding it
to a container, removing and destroying it, and finding it.
Search WWH ::




Custom Search