Enterprise JavaBeans (EJB) Training - JVA164

Enterprise JavaBeans (EJB) Training - JVA164

Course Length: 5 days
Delivery Methods: Multiple delivery options
Course Benefits
  • 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 & use stateful & stateless session beans
  • Use CDI (Contexts and Dependency Injection) to initialize resources
  • Understand and use Interceptors (Lifecycle and Business Method)
  • Use JNDI (Java Naming and Directory Interface) and be familiar with current portable naming conventions
  • 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 persistent Entities
  • Map relational schemas to persistent entities, including the use of primary keys
  • Understand and use the EntityManager
  • Understand and use Java Persistence Query Language
  • Use optimistic locking and versioning
  • Use advanced JPA capabilities such as entity relationships (1-1, 1-N, N-N, unidirectional, bidirectional), inheritance, and embeddable classes
  • Learn best practices associated with JPA applications
Available Delivery Methods
Public Class
Public expert-led online training from the convenience of your home, office or anywhere with an internet connection. Guaranteed to run .
Private Class
Private classes are delivered for groups at your offices or a location of your choice.
Course Overview

This Enterprise JavaBeans (EJB) Training course covers EJB 3.2 and JPA2 and 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 CDI / 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).

The course uses hands-on labs and a well-paced approach to make this complex technology understandable in an accelerated fashion. You will come away with a comprehensive understanding of EJB and the important issues that need to be considered to use it in real world applications. This course can be customized to your requirements.

Course Outline
  1. Introduction
    1. Overview of EJB and Java Persistence API (JPA)
      1. Goals of EJB, EJB in the Java EE architecture
    2. EJB 3.2 Overview
      1. Session Beans, Persistent Entities, Message Driven Beans
    3. Lab: Server setup and introduction
  2. Session Beans
    1. Session Bean Overview
      1. Services provided, Stateless and Stateful Beans
      2. Defining a Session Bean - EJB 3 Annotations
      3. The Bean Implementation, Remote and Local Business Interface
    2. Packaging and Deployment
      1. ejb-jar file, Deployment Descriptors in EJB 3
      2. EAR file
      3. JEE 6+ WAR files and EJB
      4. The EJB Container
    3. Lab: Creating a Stateless Session Bean
    4. JNDI Overview
      1. Distributed Naming and Lookup
      2. Context and InitialContext
      3. Using JNDI
    5. Writing an EJB 3 Client
      1. Client View of a Session Bean
      2. JEE 6 Portable EJB Lookup Names
      3. Running the Client
    6. Lab: Creating an EJB Client
  3. Additional Capabilities
    1. Resources and Dependency Injection
      1. EJB referencing another EJB
      2. Injecting with CDI/@Inject and with @EJB
      3. CDI Qualifiers and Producers
      4. Referencing Resources, Environment Entries
      5. Connection Factories (DataSource and others)
    2. Lab: Using Dependency Injection
    3. Lab: Creating and Using Environment Entries
    4. Session Bean Lifecycle and Interceptors
      1. Stateless Session Bean Lifecycle
      2. Business Method Interceptors,InvocationContext, Lifecycle Callback Interceptors, Interceptor Classes
    5. Lab: Working with Interceptors
    6. Asynchronous Methods, Singleton Session Beans
    7. Stateful Session Beans
      1. Overview
      2. Defining, Client Relationship
      3. Lifecycle, Activation, Passivation
    8. Lab: Stateful Session Beans
    9. Timer Service
      1. Programmatic Timers
      2. Calendar-Based Timers
    10. Lab: Working with Timers
  4. Message-Driven Beans
    1. Overview of Messaging Systems
      1. Messaging, Loose Coupling
      2. Pub/Sub, Point2Point
    2. Overview of JMS API
      1. Overview and Structure
      2. ConnectionFactory and Destination
      3. JMS Producer and Consumer Client example
      4. JMS Messages
    3. Message-Driven Beans (MDB)
      1. Overview and Goals
      2. @MessageDriven and MDB example
      3. Configuring with activationConfig
      4. State Diagram and Interceptors
    4. Lab: Message Driven Beans
  5. Transactions and Security
    1. Overview of Transactions and Transactional Systems
      1. ACID, Transaction Managers, Resource Managers
    2. Transactions in EJB 3
      1. Declarative Transaction Management
      2. Transaction Attributes and Transactional Scope
      3. Transaction Scenarios and Bean-Managed Tx
    3. Lab: Working with Transactions
    4. Security
      1. Java EE Security Overview (Role-based)
      2. @RolesAllowed, @PermitAll, Role "**"
      3. Programmatic Security
    5. Lab: Integrating EJB and Java EE Security
  6. Exceptions
    1. Exception Overview
      1. Checked and Unchecked Exceptions
    2. Exceptions in EJB 3
      1. Application Exceptions, System Exceptions
    3. EJB 3 Best Practices
      1. When to Use, Coarse-Grained Business Interfaces, Session Façade, Transaction Guidelines, Clustering
  7. Introduction to Java Persistence API V2 (JPA2)
    1. Overview
    2. Persistence Layers, Object-Relational Mapping (ORM), JDBC
    3. JPA Overview
    4. Mapping with JPA
    5. Entities and @Entity, ids and @Id,
    6. Generated Id Values
    7. Basic Mapping Types
    8. Lab: Mapping an Entity Class
    9. EntityManager and Persistence Context
    10. Persistence Unit and persistence.xml
    11. Persisting to the DB, the EntityManager,
    12. Injecting an EntityManager
    13. Retrieving Persistent Entities
    14. Lab: Using the EnityManager to persist and find an Entity
    15. More About Mappings
    16. Lab: Refining your Mappings
  8. Updates and Queries
    1. Inserting and Updating
      1. Transient, Persistent, Detached, Removed
      2. Persisting new Entities, Updating a Persistent Instance
    2. Lab: Inserting and Updating an Entity
    3. Querying and JPQL
      1. Object Based Queries, Select statements, WHERE clause
      2. Named Queries
    4. Lab: Creating and Using JPQL Queries
    5. Criteria API
    6. Lab: Criteria Querying
    7. The Persistence Lifecycle - JPA Entity States, Lifecycle, and Persistence Context
    8. Versioning and Optimistic Locking
      1. Overview
      2. Detached Entities
      3. Creating Versioned Entities
    9. Lab: Optimistic Locking
  9. Entity Relationships
    1. Relationships Overview
      1. Object Relationships, Participants, Roles, Directionality, Cardinality
    2. Relationship Mapping
      1. Mapping Overview (1-1, 1-N, N-1, N-N)
      2. Unidirectional and Bidirectional
      3. Mapping One-One, One-Many
      4. Join Columns
      5. Relationship Inverses
    3. Lab: Mapping Entity Relationships
      1. Many-Many Relationships
      2. Lazy and Eager Loading
      3. Cascading
      4. Queries Across Relationships (Inner Joins, Outer Joins, Fetch Joins)
    4. Lab: Querying Across Relationships
    5. Inheritance Mapping
      1. Entity Inheritance
      2. Single Table, Joined (Table per Subclass), Table per Concrete Class
      3. Pros and Cons
    6. Lab: Mapping Inheritance
    7. Other Mapping Capabilities - Embedded Objects, Compound Primary Keys, and Element Collections
  10. Additional JPA Capabilities
    1. Queries - Projection, Aggregate, Bulk Update/Delete
    2. Extended Persistence Contexts
    3. XML Mapping Files
    4. EJB and Java SE
    5. Best Practices
      1. Primary Keys, Named Queries, Lazy/Eager Loading, Transactional Semantics, Encapsulation, Report Queries
Class Materials

Each student will receive a comprehensive set of materials, including course notes and all the class examples.

Class Prerequisites

Experience in the following is required for this Java EE class:

  • Solid Java programming skills and understanding of OO Java and Java-5 language features is essential.
  • Experience with developing Java web applications is very helpful for this course, but not strictly required.
  • Some knowledge of XML will be useful for writing the occasional deployment descriptor, but is not required.
Register for a Live Class
Please select a class.
Request a Private Class
  • Private Class for your Team
  • Online or On-location
  • Customizable
  • Expert Instructors
Request Pricing