O'Reilly logo

Java® Programming 24-Hour Trainer by Yakov Fain

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

Chapter 32

Introduction to Enterprise JavaBeans

This lesson introduces you to one of the Java EE technologies, Enterprise JavaBeans, which can be used for implementing the business tier in a distributed application (refer to Figure 26-1). Lessons 27 and 28 were about various ways of programming the presentation tier on the Web; in Lessons 30 and 31 you learned how to organize communication between the different tiers of the application using messaging. You programmed the application business logic in POJOs.

Now you’ll see how to program the business tier in EJBs, which are also POJOs, but managed by an EJB container. With the release of Java EE 6, EJB 3.1 and the Java Persistence API (JPA) 2.0 do offer you a clean and simple way to implement solutions for business logic and data persistence. The features covered in this lesson will work in application servers that support EJB 3.1. Such servers include GlassFish v3, JBoss 6, and WebSphere 8, and more vendors are working on making their application servers Java EE 6–certified. There is also the Apache TomTom bundle, which includes the open-source Apache OpenEJB project; at the time of this writing this bundle partially supports EJB 3.1.

In this lesson I’ll introduce you to various types of EJBs, and the next lesson is about persisting data with JPA.

Who Needs EJB Containers?

What’s wrong with POJOs? Why not just implement business logic there? You certainly can, but most likely you’d need to spend additional time manually programming ...

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