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