EJB 3 in Action, Second Edition
Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan
  • April 2014
  • ISBN 9781935182993
  • 560 pages
  • printed in black & white

The ultimate tutorial for EJB 3.

Luis Peña, HP

Building on the bestselling first edition, EJB 3 in Action, Second Edition tackles EJB 3.2 head-on, through numerous code samples, real-life scenarios, and illustrations. This book is a fast-paced tutorial for Java EE business component development using EJB 3.2, JPA 2 and CDI. Besides covering the basics of EJB 3.2, this book includes in-depth EJB 3.2 internal implementation details, best practices, design patterns, and performance tuning tips.

Table of Contents show full



about this book

about the authors

about the cover illustration

Part 1 Overview of the EJB landscape

1. What’s what in EJB 3

1.1. EJB overview

1.2. Understanding EJB types

1.4. EJB runtimes

1.5. Brave new innovations

1.6. Changes in EJB 3.2

1.7. Summary

2. A first taste of EJB

2.1. Introducing the ActionBazaar application

2.2. Building business logic with EJB 3

2.3. Using CDI with EJB 3

2.4. Using JPA 2 with EJB 3

2.5. Summary

Part 2 Working with EJB components

3. Building business logic with session beans

3.1. Getting to know session beans

3.2. Stateless session beans

3.3. Stateful session beans

3.4. Singleton session beans

3.5. Asynchronous session beans

3.6. Summary

4. Messaging and developing MDBs

4.1. Messaging concepts

4.2. Introducing JMS

4.3. Working with MDBs

4.4. MDB best practices

4.5. Summary

5. EJB runtime context, dependency injection, and crosscutting logic

5.1. EJB context

5.2. Using EJB DI and JNDI

5.3. AOP in the EJB world: interceptors

5.4. Summary

6. Transactions and security

6.1. Understanding transactions

6.2. Container-managed transactions

6.3. Bean-managed transactions

6.4. EJB security

6.5. Summary

7. Scheduling and timers

7.1. Scheduling basics

7.2. Declarative timers

7.3. Using programmatic timers

7.4. Summary

8. Exposing EJBs as web services

8.1. What is a web service?

8.2. Exposing EJBs using SOAP (JAX-WS)

8.3. Exposing EJBs using REST (JAX-RS)

8.4. Choosing between SOAP and REST

8.5. Summary

Part 3 Using EJB with JPA and CDI

9. JPA entities

9.1. Introducing JPA

9.2. Domain modeling

9.3. Implementing domain objects with JPA

9.4. Entity relationships

9.5. Mapping inheritance

9.6. Summary

10. Managing entities

10.1. Introducing EntityManager

10.2. Persistence operations

10.3. Entity queries

10.4. Summary

11. JPQL

11.1. Introducing JPQL

11.2. Criteria queries

11.3. Native queries

11.4. Summary

12. Using CDI with EJB 3

12.1. Introducing CDI

12.2. CDI beans

12.3. Next generation of dependency injection

12.4. Interceptor and decorators

12.5. Component stereotypes

12.6. Injecting events

12.7. Using conversations

12.8. Using CDI effectively with EJB 3

12.9. Summary

Part 4 Putting EJB into action

13. Packaging EJB 3 applications

13.1. Packaging your applications

13.2. Exploring class loading

13.3. Packaging session and message-driven beans

13.4. JPA packaging

13.5. CDI packaging

13.6. Best practices and common deployment issues

13.7. Summary

14. Using WebSockets with EJB 3

14.1. Limits of request—response

14.2. Introducing WebSockets

14.3. WebSockets and Java EE

14.4. WebSockets in ActionBazaar

14.5. Using WebSockets effectively

14.6. Summary

15. Testing and EJB

15.1. Introducing testing

15.2. Unit testing EJBs

15.3. Integration testing using embedded EJBContainer

15.4. Integration testing using Arquillian

15.5. Testing effectively

15.6. Summary

Appendix A: Deployment descriptor reference

Appendix B: Getting started with Java EE 7 SDK

Appendix C: EJB 3 developer certification exam


About the Technology

The EJB 3 framework was a major advancement for Java EE developers, providing a consistent, easy to use model to create and extend applications. EJB 3 incorporates a POJO programming model and Java 5 annotations, along with the Java Persistence API (JPA), a standard for object-relational mapping. EJB 3.1, the latest version, adds full support for Context and Dependency Injection (CDI), the new standard for type-safe dependency injection for Java EE. With EJB 3.1 you create true object-oriented applications that are easy to write, maintain, and extend.

About the book

The EJB 3 framework provides a standard way to capture business logic in manageable server-side modules, making it easier to write, maintain, and extend Java EE applications. EJB 3.2 provides more enhancements and intelligent defaults and integrates more fully with other Java technologies, such as CDI, to make development even easier.

EJB 3 in Action, Second Edition is a fast-paced tutorial for Java EE business component developers using EJB 3.2, JPA, and CDI. It tackles EJB head-on through numerous code samples, real-life scenarios, and illustrations. Beyond the basics, this book includes internal implementation details, best practices, design patterns, performance tuning tips, and various means of access including Web Services, REST Services, and WebSockets.

What's inside

  • Fully revised for EJB 3.2
  • POJO persistence with JPA 2.1
  • Dependency injection and bean management with CDI 1.1
  • Interactive application with WebSocket 1.0

About the reader

Readers need to know Java. No prior experience with EJB or Java EE is assumed.

About the authors

Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan are seasoned Java architects, developers, authors, and community leaders. Debu and Reza coauthored the first edition of EJB 3 in Action.

combo USD 54,99 pBook + eBook
eBook USD 43,99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

Reza sits on the EJB 3.2 Expert Group and is a great instructor. That’s all you need to know.

John Griffin, Progrexion ASG

Thoroughly and clearly explains how to leverage the full power of the JEE platform.

Rick Wagner, Red Hat, Inc.

Provides a rock-solid foundation to EJB novice and expert alike.

Jeet Marwah, gen-E

If you have EJB troubles, this is your cure.

Jürgen De Commer, Imtech ICT