Chapter 6. Stateless Session Beans

Everything we’ve done up to this point technically could have been done without using JBoss. Our web tier simply uses the embedded Tomcat Servlet container—we could run our WAR unchanged in a standalone Tomcat instance. Our persistence tier used both JDBC and Hibernate. Again, both are available in non-JBoss installations. We simply took advantage of them because they come bundled with JBoss.

We now are firmly in the middle of the business tier. The next several chapters will focus on components that must be run in JBoss. More specifically, we’ll look at EJB components that must run inside an EJB container.

Many people would argue that Enterprise JavaBeans are what put the “E” in the Java2 Enterprise Edition. But you also could argue that web-centric applications that use only JSPs and Servlets are still legitimate J2EE applications. These next sections will introduce you to technologies that allow you to build a large-scale, distributed, transaction-based Enterprise application.

Issues with EJBs

Our two biggest complaints about EJBs are that:

  • They require a complex set of programming artifacts for deployment.

  • Developers tend to overuse them.

The complexity of the EJB programming model has hindered the adoption of J2EE. To deploy an EJB, you are dealing with as many as seven or more files (five Java files and two deployment descriptors). As you’ll see later on, the main thrust of J2EE 1.5 (which includes EJB 3.0) is to simplify and lighten ...

Get JBoss at Work: A Practical Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.