Realdolmen Education

Details

Java Enterprise Component Development with JPA 2 and EJB 3.1

This course is currently not scheduled on the open calendar, but can be organized on request.

Request Course

Duration

3 day(s)

Audience

Java developers who wish to use the new EJB 3.1 and JPA 2 specification to ease the development enterprise java applications.

Prerequisites

Have some understanding of the standard JEE API's. Having some experience with JDBC and SQL can be useful but is not required.

Objectives

Mastering the use of EJB 3.1 and JPA 2.

Methods

Classroom training with hands-on exercises.

Description

This course combines the courses Java Persistence API 2 and Enterprise JavaBeans 3.1. These specifications allow rapid and simplified component development for enterprise applications. JPA 2 enables the creation of the data layer of the application, while the business layer consists of EJB 3.1 components. The application server container will provide distribution, transactions, security and portability, making Java Enterprise development a breeze. JPA 2 builds upon the foundation laid by JPA, and adds a lot of features which were already available to many Object Relational Mapping (ORM) tools but that did not make it into the specification. JPA 2 features more flexible access modes, orphan removal, ordered lists, collections of primites and embeddables, query enhancements, criteria queries and much more. EJB 3.1 is able to leverage the potential of the technology, by adding new features which are able to fulfill the needs of modern enterprise applications. New EJB 3.1 features include the no-interface view, singleton bean, and asynchronous methods, as well as enhancements in the timer service, JNDI naming and testing with embeddable containers.

During the course, participants will gain a thourough understanding on how to create entities and map them to database tables, how to configure the different relationships between entities, and how to manipulate entities and their lifecycle. Afterwards, they will learn the powerful query language used by JPA 2 to fetch data from the database. Next, important topics such as transactions and security are discussed. Participants will continue by exploring the entire EJB architecture, which includes all types of bean, from entity beans over session beans to message-driven beans. Other topics include the use of interceptors and the timer service. Practical,instructor-led exercises will provide you with all the experience you need.

JPA 2 and EJB 3.1 are rich additions to the Java developers toolbox. This course will help you acquire the knowledge and experience needed to apply these technologies in your daily programming work. Let yourself be amazed by the ease and elegance in development, and be convinced of the power of server-side Java!

Contents

  • Introduction
    • Why Java EE?
    • History of Java EE
    • Java EE at a glance
    • Standard Java EE containers
    • What's new in Java EE 6?
    • Profiles
  • Getting started
    • Setting up
    • HelloWorld
    • Create a project
    • Adding a Stateless Session Bean
    • Testing the stateless session bean
    • Adding persistence
    • Adding a BookService EJB
    • Exercise #01
  • Java Persistence with JPA 2.0
    • Java Persistence Overview
    • JPA Specification Overview
    • What's new in JPA 2.0?
    • What is an Entity?
    • A Simple Entity
    • Querying Entities
    • Callbacks and Listeners
    • Persisting Entities
    • Configuring Persistence
    • Adding JUnit Tests
    • Exercise #02
    • Mapping an Entity
    • Configuration by Exception
    • @Table
    • @SecondaryTable
    • @Id
    • @GeneratedValue
    • Composite Primary Keys
    • @EmbeddedId
    • @IdClass
    • @EmbeddedId vs @IdClass
    • @Basic
    • Exercise #03
    • @Column
    • @Temporal
    • @Transient
    • @Enumerated
    • @Access
    • Exercise #04
    • @ElementCollection & @CollectionTable
    • @MapKeyColumn
    • Mapping with XML
    • @Embeddable & @Embedded
    • Exercise #05
    • Relationship Mapping
    • Relationships in Databases
    • Entity Relationships
    • @OneToOne bidirectional
    • @OneToOne unidirectional
    • @JoinColumn
    • @OneToMany unidirectional
    • @JoinTable
    • @OneToMany unidirectional without Join Table
    • @ManyToMany bidirectional
    • Fetching relationships
    • Default fetching strategies
    • @OrderBy
    • @OrderColumn
    • Exercise #06
    • Inheritance Mapping
    • Inheritance Diagram
    • Single-Table-per-Class Hierarchy Strategy
    • Joined-Subclass Strategy
    • Table-per-Concrete-Class Strategy
    • @AttributeOverride
    • Inheriting from Non-Entities
    • @MappedSuperclass
    • Exercise #07
    • The EntityManager
    • Application-Managed EntityManager
    • Container-Managed EntityManager
    • @PersistenceContext
    • Manipulating Entities
    • Persisting an Entity
    • Finding by ID
    • Removing an Entity
    • Orphan Removal
    • Flushing and Refreshing
    • Contains, Clear and Detach
    • Merging an Entity
    • Updating an Entity
    • Cascading Events
    • Cascading Options
    • Cache API
    • Exercise #08 (Optional)
    • JPQL
    • SELECT
    • Scalar Expressions & FROM
    • WHERE
    • Binding Parameters
    • Subqueries & ORDER BY
    • GROUP BY & HAVING
    • Bulk Delete & Bulk Update
    • Queries
    • Executing the Query
    • Dynamic Queries
    • Named Queries
    • Native Queries
    • Criteria Queries
    • Exercise #09
    • Concurrency
    • @Version
    • Optimistic Locking
    • Pessimistic Locking
    • Exercise #10
    • Entity Life Cycle
    • Callbacks
    • Listeners
    • Exercise #11
  • Enterprise components with EJB 3.1
    • Adding Business Processing
    • EJB Overview
    • Types of EJBs
    • Creating a Bean
    • Accessing a Bean
    • EJB Container
    • Embedded Container
    • Dependency Injection and JNDI
    • Callback Methods, Interceptors and Packaging
    • What's new in EJB 3.1?
    • EJB Lite vs Full EJB 3.1
    • Writing the Entity
    • Writing an EJB Stateless Session Bean
    • Changing the persistence.xml
    • Writing the Main Class
    • Writing the JUnit Test Class
    • Exercise #12
    • Session Beans
    • Stateless Beans
    • Stateful Beans
    • Singletons
    • Initializing a Singleton
    • Chaining Singletons
    • Concurrency with Singletons
    • Container-Managed Concurrency (CMC)
    • Bean-Managed Concurrency
    • Concurrent Access Timeouts
    • Different Interfaces for Session Beans
    • Session Bean Class Rules
    • Injecting Beans in the Client
    • Exercise #13
    • Portable JNDI Names
    • Dependency Injection
    • Asynchronous Calls
    • Exercise #14 (Optional)
    • The Timer Service
    • Calendar-Based Expression
    • Automatic Timer Creation
    • Programmatic Timer Creation
    • Exercise #15 (Optional)
    • Session Beans Life Cycle
    • Session Bean Callbacks
    • Interceptors
    • @AroundInvoke
    • Method Interceptors
    • Life-Cycle Interceptors
    • Chaining Interceptors
    • Exercise #16 (Optional)
    • Transactions and Security
    • Container-Managed Transactions
    • Marking a CMT for Rollback
    • Security
    • Declarative Security
    • Programmatic Security
    • Exercise #17
  • Message Driven Beans
    • Message-Oriented Middleware (MOM)
    • Java Message Service (JMS)
    • Message Driven Beans (MDB)
    • Sending Messages
    • Receiving Messages
    • JMS Models
    • Administered Objects
    • Messages
    • Asynchronous Message Receiver
    • Advanced JMS Options
    • Writing Message-Driven Beans
    • Transactions in MDB
    • Exercise #18
  • Summary and references
    • Conclusion
    • References