This book assumes that you’ve already made the decision to use EJBs. However, there are several instances where EJBs are not the best solution to a problem. It makes sense, therefore to review where EJBs are strong and then discuss situations in which EJBs don’t make as much sense. There are several situations—even some enterprise database-centric applications—in which EJBs are simply not the best choice. At the end of this section, we’ll look at some of the alternative approaches and where they might fit.
Here’s a list of situations where EJBs are strong; we haven’t distinguished between different types of EJBs.
The ability to maintain transactional integrity for complex business entities is one of an EJB’s key strengths. EJBs aren’t alone in providing straightforward transactional control over a single data repository. However, EJBs shine where multiple resources (relational databases, messaging systems, etc.) are involved because they allow transactions to spread across as many different resources as you like, so long as the resources support distributed transactions.
Business services often live on a remote server. For example, a business enterprise will have many different systems, ranging in degrees of inflexibility and entrenchment. One of these systems may need to access another; EJBs, which are inherently distributed, are often the simplest way to distribute remote services. ...