Enterprise JavaBeans 3.2 (JEE 7) and JPA2
Private Training

Course Summary

The Enterprise JavaBeans 3 specification is a deep overhaul of the EJB specification that improved the EJB architecture by reducing its complexity from the developer’s point of view. It leverages annotations (introduced in Java 7) and Object-Relational Mapping (ORM) technologies to eliminate the dependence on complex EJB APIs, allow POJO (Plain Old Java Object) based development, and provide an effective technology for creating distributed, transactional components, and for mapping relational data to an object schema. This 5 day course provides thorough coverage of the EJB3 technology – presented in a clear and effective manner. It starts with the basic concepts and APIs of EJB and then continues on with complex topics such as message driven beans and transactions. New concepts such as the use of annotations and the use of Dependency Injection to initialize references are covered in depth. The course also includes thorough coverage of managing persistence using the Java Persistence API 2 (JPA2). This course provides additional coverage of JPA as compared to our Fast Track to EJB3 course.

Audience
Java developers who want to use EJB 3.2.
Course Length
5 Days
Prerequisites
One year of Java programming experience (or equivalent) is preferred. Knowledge of relational databases and JDBC is strongly recommended.

Objectives

Understand the EJB 3 architecture and API, and how it fits into the overall Java EE architecture.

Understand and use the EJB 3 annotations.

Create, deploy, and use stateful and stateless session beans.

Use CDI (Contexts & Dependency Injection) to initialize resources.

Understand and use Interceptors.(Lifecycle and Business Method)

Use JNDI (Java Naming and Directory Interface)

Write EJB clients (remote and local)

Understand, deploy, and use message-driven beans.

Understand distributed transactions, the Java Transaction API, and the EJB transaction model.

Understand and use the EJB security model.

Understand practical architectural issues associated with EJB applications

Understand the new Java Persistence API (JPA).

Create, deploy, and use JPA persistence entities.

Understand and use the Entity Manager.

Understand and use Java Persistence Query Language.

Use optimistic locking and versioning.

Use advanced JPA capabilities such as entity relationships, inheritance, and embeddable classes.

Detailed Outline

  1. Overview
    • What is EJB?
    • EJB Goals
    • Types of Enterprise JavaBeans
    • Java Persistence API
    • EJB and Java EE (Enterprise Editions)
    • EJB in Java EE Architecture
    • SOA and EJB
    • SOA with Web Services and EJB
    • EJB 3.0 Overview
    • EJB 2.X Problems
    • EJB 3.0 Goals
    • EJB 3.1 and 3.2 Goals
    • Session Bean Usage
    • Persistent Entity Usage
    • MDB Usage
  2. Session Beans
    • What are Session Beans
    • Defining a Session Bean
    • Calculator Bean Local Business Interface
    • Remote and Local Business Interfaces
    • Calculator Bean Local Business Interface
    • Simplified Interface Declaration (EJB 3.2)
    • How Annotations Work
    • Annotation Definition
    • Using Annotations
    • Packaging and Deployment
    • JEE Packaging
    • ejb-jar File
    • Deployment Descriptor
    • ejb-jar File Structure
    • Web Application Structure – JEE 6/7
    • Server Deployment
    • JNDI Overview
    • JNDI Tree Structure
    • The Context Interface
    • Specifying the InitialContext Properties
    • Using JNDI
    • EJB Remote Client
    • EJB 3.1+ – Portable JNDI Names
  3. Additional EJB Capabilities
    • Dependency Injection
    • An EJB referencing another EJB
    • ItemRepository
    • More about @Inject
    • Injection Using @EJB
    • Deployment Descriptors
    • The XML Deployment Descriptor
    • Obtaining Resources
    • Qualifiers
    • More about Annotation Declarations
    • CDI Producer
    • Producing Other Resources
    • Resource Manager Connection Factories
    • The @Resource Annotation
    • Using Logical Lookup Names
    • Simple Environment Entries
    • Setter Injection
    • Deployment Descriptor vs Annotation
    • Stateless Session Bean Lifecycle & Interceptors
    • Life Cycle of SSB
    • Client Call of a Stateless SB Method
    • Business Method Interceptors
    • InvocationContext Interface Details
    • Interceptor Class
    • Lifecycle Interceptor in the Bean Class and Separate Class
    • Asynchronous Methods, Singleton Session Beans
    • Stateful Session Beans
    • Coding a Stateful Session Bean
    • Stateful Session Bean Clients
    • Using the SFSB in a JSP
    • Stateful Session Passivation/Activation
    • Stateful Session Bean State Diagram
    • The Timer Service
    • Programming Timers
    • How the Timer Works
    • Issues with Programmatic Timers
  4. Message-Driven Beans
    • Overview of Messaging Systems
    • Loose Coupling
    • Publish/Subscribe – Illustrated
    • Point-to-Point
    • Overview of JMS API
    • What is Java Message Service?
    • API Structure
    • Administered Objects
    • Client Workflow
    • Synchronous Queue Consumer Client
    • JMS Message Types
    • Message-Driven Beans (MDB)
    • JEE Message Producers and Consumers
    • MDB Consumption of a Message
    • Activation Configuration Properties
    • Specifying a Destination Using a DD
    • Message-Driven Bean Lifecycle
    • Interceptor Methods
  5. Transactions and Security
    • Transaction Definition
    • Transactional System
    • Transactions in EJB
    • EJB Declarative Transaction Management
    • Specifying Transaction Attributes
    • Beans Have a Say in Transactions
    • Transactions Attributes
    • Explicit / Bean-Managed Transactions
    • Transaction Isolation Levels
    • Security in EJB
    • JEE Security
    • Roles
    • Authentication
    • Programmatic Security
    • Transport Level Security with SSL
  6. Exception Handling and Best Practices
    • Exception Overview
    • Checked and Unchecked Exceptions
    • Exceptions in EJB 3
    • Application and System Exceptions
    • Container Handling of System Exception
    • EJB 3 Best Practices
    • When to Use EJB
    • Session Façade Structure
    • Transaction Duration
    • Tuning
    • Clustering
  7. Introduction to Java Persistence API (JPA2)
    • JPA Overview
    • Object-Relational Mapping (ORM) Issues
    • JPA Benefits
    • JPA Architecture
    • Mapping a Simple Class
    • Entity Class Requirements
    • The Event Class
    • The EVENTS Table
    • Mapping Properties
    • Entity Manger and Persistence Context
    • Obtaining an Entity Manager
    • Retrieving Persistent Objects
    • More about Mappings
  8. Updates and Queries
    • Inserting and Updating
    • Persisting and Updating New Entities
    • Querying and JPQL
    • JPQL Basics
    • Executing a Query
    • Where Clause
    • JPQL Operators and Expressions
    • Query Parameters
    • Named Queries
    • Criteria API
    • Path Expressions
    • WHERE Clauses
    • The Persistence Lifecycle
    • Transient & Persistent State
    • Synchronization To The Database
    • Versioning and Optimistic Locking
    • Locking Objects
  9. Entity Relationships
    • Object Relationships, Directionality
    • Characteristics of Relationships
    • Mapping Relationships
    • The Table Structure – Many-To-One
    • The Owning Side
    • Mapping the Bidirectional Relationship
    • More on the Inverse Side
    • Collection Types
    • Cascading Operations
    • Mapping Inheritance
    • Entity Inheritance
    • Single Table, Joined (Table per Subclass), Table per Concrete Class
    • Embedded Objects
    • Compound Primary Keys
    • Element Collections (JPA 2)
  10. Additional JPA Capabilities
    • Queries – Projection, Aggregate, Bulk Update/Delete
    • Extended Persistence Contexts
    • XML Mapping Files
    • Java Persistence with Java SE
    • JPA Best Practices
    • Primary Key Considerations
    • Consider Going Outside of JP
    • Know Your Provider Implementation
    • Resources (EJB3 and JPA)