O'Reilly logo

Enterprise JavaBeans, Fourth Edition by Richard Monson-Haefel, Bill Burke, Sacha Labourey

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Should You Use EJBs?

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.

When to Use EJBs

Here’s a list of situations where EJBs are strong; we haven’t distinguished between different types of EJBs.

Single and multisystem business transactions

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.

Distributed functionality

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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required