interface with a facade that combines many different round-trips into one, sav-
ing network traffic and boosting performance significantly.
The rest of the antipatterns in the chapter relate to the type of EJB used to
solve a particular problem. EJB entity beans in particular are like golden ham-
mers, and the whole world looks like a nail. Also, there may be situations
where we use bean-managed persistence or a relational mapping tool to opti-
mize performance, session beans to reduce overhead, or stateful session beans
for a lighter approach to keeping session-duration conversations. The key to
the successful use of EJB s is not to be lulled to complacency by the ease of
implementation and pay attention to performance concerns.
Antipatterns in this chapter
These are the templates for the antipatterns that appear in this chapter. They
provide an excellent summary format and form the basis of the cross-refer-
ences in appendix A.
R ELATED ANTIPATTERNS : The Cacheless Cow. Some specializations
of this antipattern exist. Lack of a cache can also cause round-
D ESCRIPTION : Round-tripping occurs when a chatty interface falls
on a distributed boundary. For EJB s, a client (usually a controller or
JSP ) accesses the remote interface of a distributed entity bean. Since
an entity bean usually exposes many fields and sometimes collec-
tions, this results in many round-trip communications, absolutely
M OST FREQUENT SCALE : Application.
R EFACTORED SOLUTION NAME : The Facade.
R EFACTORED SOLUTION TYPE : Software.
R EFACTORED SOLUTION DESCRIPTION : The most common solution
to this problem is the facade. This interface is implemented with a
distributed call, like a session bean. The interface combines many
chatty communications into a single, consolidated call.
T YPICAL CAUSES : A common cause is the use of major frameworks
like EJB s near interface boundaries without modification.
S YMPTOMS , CONSEQUENCES : Applications are slow.