EJB 3 Developer Guide

EJB 3 Developer Guide
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 25%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 59%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • A rapid introduction to the features of EJB 3
  • EJB 3 features explored concisely with accompanying code examples
  • Easily enhance Java applications with new, improved Enterprise Java Beans


Book Details

Language : English
Paperback : 276 pages [ 235mm x 191mm ]
Release Date : May 2008
ISBN : 1847195601
ISBN 13 : 9781847195609
Author(s) : Michael Sikora
Topics and Technologies : All Books, Application Development, Enterprise, Java


Table of Contents

Chapter 1: Introduction to the EJB 3 Architecture
Chapter 2: Session Beans
Chapter 3: Entities
Chapter 4: Object/Relational Mapping
Chapter 5: The Java Persistence Query Language
Chapter 6: Entity Manager
Chapter 7: Transactions
Chapter 8: Messaging
Chapter 9: EJB Timer Service
Chapter 10: Interceptors
Chapter 11: Implementing EJB 3 Web Services
Chapter 12: EJB 3 Security
Appendix A: Annotations and Their Corresponding Packages
  • Chapter 1: Introduction to the EJB 3 Architecture
    • Introduction to the Java EE Architecture
    • The EJB 3 Architecture
      • EJB Container Services
      • The JPA Persistence Engine
      • EJB 3 Compared with Earlier Versions
    • Getting Started
      • Installing GlassFish
      • Testing the Installation
      • Accessing the Administrator Console
      • Shutting Down GlassFish
      • Downloading Example Source Code
    • Summary
  • Chapter 2: Session Beans
    • Introduction
    • Stateless Session Beans
      • Annotations
      • Creating a Session Bean Client
      • Running the Example
      • The Program Directory Structure
      • The Ant Build Script
      • The Application Client Container
        • Building the Application
      • Stateless Session Bean's LifeCycle
    • Stateful Session Beans
      • Stateful Session Bean's LifeCycle
    • Local Interfaces
    • Summary
  • Chapter 3: Entities
    • Introduction
    • EJB 3 Entities
      • Comparison with EJB 2.x Entity Beans
      • Mapping an Entity to a Database Table
    • Introducing the EntityManager
    • Packaging and Deploying Entities
      • The Program Directory Structure
      • Building the Application
    • Field-Based Annotations
    • Generating Primary Keys
      • Table Strategy
      • Sequence Strategy
      • Identity Strategy
      • Auto Strategy
    • Overriding Metadata Defaults
    • Summary
  • Chapter 4: Object/Relational Mapping
    • O/R Mapping Default Behavior
      • A Banking Example Application
        • Customer Entity
        • Account Entity
        • Address Entity
        • Referee Entity
      • Testing the Application
    • O/R Mapping Overriding Defaults
      • Customer Entity
      • Account Entity
      • Address Entity
      • BankServiceBean
    • O/R Mapping Additional Annotations
      • Referee Class
      • BankServiceBean
      • Composite Primary Keys
    • O/R Inheritance Mapping
      • SINGLE_TABLE Strategy
      • JOINED Strategy
      • Table per Concrete Class Strategy
    • Summary
  • Chapter 5: The Java Persistence Query Language
    • Introduction
    • Simple Queries
    • Projection
    • Conditional Expressions
    • Aggregate Functions
      • GROUP BY
      • HAVING
    • Queries with Relationships
    • Joins
      • Inner Joins
      • Outer Joins
      • Fetch Joins
    • Collection Comparison Expressions
    • Constructor Expressions
    • SubQueries
    • Functions
      • CONCAT
      • TRIM
      • LOWER and UPPER
      • LENGTH
      • LOCATE
      • ABS
      • SQRT
      • MOD
      • SIZE
    • Queries with Parameters
      • Positional Parameters
      • Named Parameters
    • Named Queries
    • Handling Date and Time
      • @Temporal annotation
      • Queries with Date Parameters
      • Datetime Functions
    • Bulk Update and Delete
    • Native SQL
    • Summary
  • Chapter 6: Entity Manager
    • Application-managed Entity Manager
    • Entity Manager Merge
    • Entity Manager Methods
      • remove()
      • contains()
      • flush()
      • setFlushMode()
      • refresh()
      • clear()
    • Cascade Operations
      • persist
      • remove
      • merge
      • refresh
      • all
    • Extended Persistence Context
    • Entity LifeCycle Callback Methods
      • Entity Listeners
    • Summary
  • Chapter 7: Transactions
    • Introduction
    • Container-Managed Transaction Demarcation
      • SUPPORTS
      • REQUIRED
      • Never
    • Examples of Transaction Attributes
      • REQUIRED Example
      • REQUIRES_NEW Example
      • NOT_SUPPORTED Example
      • SUPPORTS Example
      • MANDATORY Example
      • NEVER Example
    • Controlling Container Managed Transactions
      • SessionSynchronization Interface
      • Doomed Transactions
    • Concurrency and Database Locking
      • Isolation Levels
      • Lost Update Problem
      • Versioning
      • Read and Write Locking
    • UserTransaction Interface
    • Summary
  • Chapter 8: Messaging
    • Introduction
    • Java Message Service (JMS) API
    • Queue Producer and Consumer Examples
      • Synchronous Queue Consumer Example
        • Running the Queue Producer and Synchronous Queue Consumer Examples
      • An Asynchronous Queue Consumer Example
        • Running the Asynchronous Queue Consumer Example
    • Topic Producer and Consumer Examples
      • Synchronous Topic Consumer Example
        • Running the Topic Producer and Synchronous Topic Consumer Examples
      • An Asynchronous Topic Consumer Example
        • Running the Asynchronous Topic Consumer Example
    • Motivation for Message-Driven Beans
    • A Simple Message-Driven Bean Example
      • A Session Bean Queue Producer
      • A Message-Driven Bean Queue Consumer
    • MDB Activation Configuration Properties
      • acknowledgeMode
      • subscriptionDurability
      • messageSelector
    • MessageDrivenContext
    • MDB LifeCycle
    • MDB Example Revisited
    • Sending Message Confirmation to a Client
    • MDBs and Transactions
    • Summary
  • Chapter 9: EJB Timer Service
    • Introduction
    • Timer Service Examples
      • A Single Event Example
      • An Interval Event Example
    • A Timer Interface Example
    • Timers and Transactions
    • Summary
  • Chapter 10: Interceptors
    • Interceptor Methods
    • Interceptor Classes
    • Default Interceptors
    • Interceptor Communication
    • Summary
  • Chapter 11: Implementing EJB 3 Web Services
    • Overview of Web Service Concepts
      • The SOAP Protocol
      • The WSDL Standard
      • The UDDI Standard
      • SOA and Web Services
    • Creating a Java Application Web Service
      • Creating an Endpoint Implementation Interface
      • The WSDL Document
        • The <portType> Element
        • The <binding> Element
        • The <service> Element
        • The <message> and <types> Elements
      • The GlassFish WSGEN Tool
      • Deploying a Java Application as a Web Service
      • The GlassFish Admin Console Test Harness
      • Creating a Java Web Service Client
    • Overriding JAX-WS Annotation Defaults
    • Deploying an EJB Session Bean as a Web Service
      • Packaging an EJB Web Service
      • Creating an EJB Web Service Client
    • Summary
  • Chapter 12: EJB 3 Security
    • Java EE Container Security
    • Authentication
      • GlassFish Authentication
      • Mapping Roles to Groups
      • Authenticating an EJB Application Client
    • EJB Authorization
      • Declarative Authorization
        • Denying Authorization
        • EJB Security Propagation
      • Programmatic Authorization
    • Java EE Web Container Security
      • Web-Tier Authorization
      • Transport Layer Security
      • Web-Tier Authentication
      • Example of Web-Tier Authentication and Authorization
    • Summary

Michael Sikora

Michael Sikora is an enterprise architect with a background in the Unified Process and JEE. He has a particular interest in object oriented and database technology. He has worked for many large UK clients such as ICL Fujitsu, Mercury Communications, Vodafone and BUPA. He has used Java since 2000. Before that he spent a decade designing and developing database and datawarehouse systems. He has experience of Oracle, PL/SQL and C. In the 1980s he worked for Shell developing exploration software. He graduated in Mathematics from Essex University and has Masters degrees from London University and Imperial College.

Michael currently resides in London, England and enjoys mountaineering and still hopes to complete the seven summits. His website is www.ejbconsultants.com whilst he also maintains a blog at http://msikora.typepad.com

Contact Michael Sikora

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.

Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

EJB 3 Developer Guide +    OpenStack Cloud Computing Cookbook =
50% Off
the second eBook
Price for both: €29.90

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

This book will teach you the core elements of EJB 3 technology. You will:

  • Gain a rapid introduction to the EJB 3 essentials while learning about the underlying principles
  • Create Entities, Message-Driven Beans, Session Beans and their clients
  • Look at running an EJB client from an application client container
  • Learn how to package and deploy an EJB
  • Use JQPL (Java Persistence Query Language)
  • Explore the entity manager interface
  • Learn about object/relational mapping with EJB 3
  • Look at the Java Messaging API and message-driven beans
  • Look at transactions, interceptors, and EJB timer services
  • Understand how EJB 3 differs from the 2.x version
  • Implement EJB 3's security features

In Detail

The EJB 3 (Enterprise Java Beans version 3) specification is a core component of enterprise-level JEE (Java Platform Enterprise Edition) implementations and this improved version is set to simplify the development of Enterprise Java applications.

This book covers the core elements of EJB 3 technology, exploring them in a concise manner with many supporting examples. You will gain a thorough understanding of EJB 3 technology and learn about the most important features of EJB 3 quickly. 


This book is a fast-paced tutorial that explores the key features of EJB 3 with many accompanying examples. This book is not a complete reference guide, but a concise exploration of EJB 3's core elements.

Who this book is for

This book is primarily aimed at professional developers who already have a working knowledge of Java. Enterprise architects and designers with a background in Java would also find this book of use. Previous experience of working with Java is essential and knowledge of relational databases is desirable.

As this book is an introduction to EJB 3, it is aimed at those who are new to EJB 3. As the new version of EJB is so radically different from the previous version (EJB 2.x), the book is suitable for and should be of interest to those who have had experience working with EJB 2.x. The text makes it clear where the differences between the versions of EJB lie, although they are not explored in detail.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software