Download (direct link):
328 Part Three
quite a few traps. Because the Java language is so flexible, there is the ability for programmers to add unneeded complexity (thread management, etc.) even when the container provides this support. Because of misunderstandings of the J2EE environment, design errors pop up. The use of database connections and different types of databases present other challenges, and the use of new Java Web services APIs, such as Java API for XML-based Remote Procedure Calls (JAX-RPC) and the Java API for XML Registries (JAXR), provides more opportunities for misunderstandings and traps to occur.
In this section of the book, we have tried to focus on areas of the enterprise tier where we have seen and experienced problems and confusion. Although some of the pitfalls could possibly be tied to the other tiers (JDBC pitfalls, for example), we placed them in this section because developers make use of them in the enterprise tier. Many of the pitfalls in this section revolve around Enterprise JavaBeans, some focus on APIs related to Web services, and some focus on design pitfalls. In this section, many pitfalls focus on "the big picture" in a multi-tier environment.
Here are highlights of pitfalls in this section:
J2EE Architecture Considerations (Item 37). J2EE has become a major player in enterprise IT solutions. Developers are often confused about how to apply this architecture to their solution. This pitfall discusses how those mistakes occur and considerations for avoiding them.
Design Strategies for Eliminating Network Bottleneck Pitfalls (Item 38). This pitfall focuses on pitfalls where network calls and bandwidth are a major factor and shows performance-tuning design strategies to use between tiers.
I'll Take the Local (Item 39). EJB 2.0 introduced the local interface as a mechanism for referencing EJBs within the same process. This pitfall discusses the why and how of local interfaces over the traditional remote interface.
Image Obsession (Item 40). Frequently, Enterprise Java applications are developed on one platform and deployed on another. This can cause some cross platform issues. This pitfall examines one of those issues regarding server generated images.
The Problem with Multiple Concurrent Result Sets (Item 41). When you have to interface with many different types of databases, your connections may be handled in different ways. This pitfall addresses a problem that can arise when you use multiple ResultSet objects concurrently.
Generating Primary Keys for EJB (Item 42). There are many ways to create unique primary keys for entity beans. Some of these techniques are wrong, some suffer performance problems, and some tie your implementation to the container. This pitfall discusses the techniques and offers solutions.
The Stateful Stateless Session Bean (Item 43). Developers frequently confuse the stateless nature of the stateless session bean. This pitfall provides an example of where this confusion can cause problems and clarifies just how stateful the stateless bean is.
The Unprepared PreparedStatement (Item 44). The PreparedStatement is a powerful capability in server side applications that interface with a database. This pitfall explores a common mistake made in the use of the PreparedStatement.
J2EE Architecture Considerations 329
Take a Dip in the Resource Pool (Item 45). Container resource pools are frequently overlooked by developers, who instead rely on several techniques that predate this capability. This pitfall explores techniques currently used and how a container resource pool is the superior choice.
JDO and Data Persistence (Item 46). Data persistence is an important component for all enterprise systems. This pitfall introduces Java Data Objects as a new persistence mechanism that uses both Java and SQL constructs for data transactions.
Where's the WSDL? Pitfalls of Using JAXR with UDDI (Item 47). This item addresses pitfalls with using JAXR with UDDI. The advent of Web services brought us a new API—the Java API for XML Registries. Problems can occur when you are querying UDDI registries with JAXR. This pitfall discusses the problems in depth.
Performance Pitfalls in JAX-RPC Application Clients (Item 48). As JAX-RPC is adopted into the J2EE environment, it is important to know the gory details of how slow or fast your connections could be when using some of JAX-RPC's features on the client side. This pitfall demonstrates an example and shows speed statistics.
Get Your Beans Off My Filesystem! (Item 49) The EJB specification lists certain programming restrictions for EJB developers. This pitfall shows an example of how one of these restrictions is often violated and provides an alternative solution.
When Transactions Go Awry , or Consistent State in Stateful Session EJBs (Item 50). Data transactions are an important part of all distributed system applications. This pitfall shows how the SessionSynchronization interface and the Memento pattern can be employed as vehicles in enterprise applications to save and restore data.