Java Reference
In-Depth Information
Chapter 2. A first taste of EJB
This chapter covers
• The ActionBazaar application
• Stateless and stateful session beans in ActionBazaar
• Integrating CDI and EJB 3
• Persisting objects with JPA 2
In the age of globalization, learning a new technology by balancing a book on your lap
while hacking away at a business problem on the keyboard has become the norm. Let's face
it—somewhere deep down you probably prefer this “baptism by fire” to trudging the same
old roads over and over again. This chapter is for the brave pioneer in all of us, eager to peek
over the horizon into the new world of EJB 3.
The first chapter gave you a 20,000-foot view of the EJB 3 landscape from a hypersonic jet.
We defined EJB, described the services it offers and the EJB 3 architectural blueprint, and
described how EJB 3 is related to CDI and JPA 2. This chapter is a low-altitude flyover with
a reconnaissance airplane. Here we'll take a quick look at the code for solving a realistic
problem using EJB 3, JPA 2, and CDI. The example solution will use some of the EJB 3
component types, a layered architecture, and some of the services we discussed in chapter 1 .
You'll see firsthand exactly how easy and useful EJB 3 is and how quickly you could pick it
up.
If you aren't a big fan of views from heights, don't worry. Think of this chapter as that first
day at a new workplace, shaking hands with the strangers in the neighboring cubicles. In the
chapters that follow, you'll get to know more about your new coworkers' likes, dislikes, and
eccentricities, and you'll learn how to work around these foibles. All you're expected to do
right now is put names to faces.
Running the example code
At this point, we encourage you to start exploring the code examples for this topic. You can
peek at the entire solution by downloading the zip file containing the code examples from
www.manning.com/panda2 . We highly recommend that you set up your favorite develop-
Search WWH ::




Custom Search