You are previewing The Java EE 7 Tutorial, Volume 2, Fifth Edition.
O'Reilly logo
The Java EE 7 Tutorial, Volume 2, Fifth Edition

Book Description

The Java EE 7 Tutorial: Volume 2, Fifth Edition, is a task-oriented, example-driven guide to developing enterprise applications for the Java Platform, Enterprise Edition 7 (Java EE 7). Written by members of the Java EE documentation team at Oracle, this book provides new and intermediate Java programmers with a deep understanding of the platform.

This guide includes descriptions of platform features and provides instructions for using the latest versions of NetBeans IDE and GlassFish Server Open Source Edition. The book introduces Enterprise JavaBeans components, the Java Persistence API, the Java Message Service (JMS) API, Java EE security, transactions, resource adapters, Java EE Interceptors, Batch Applications for the Java Platform, and Concurrency Utilities for Java EE. The book culminates with three case studies that illustrate the use of multiple Java EE 7 APIs.

Table of Contents

  1. About This eBook
  2. Title Page
  3. Copyright Page
  4. Contents
  5. Preface
    1. Audience
    2. Before You Read This Book
    3. Related Documentation
    4. The Oracle Accessibility Program
    5. Conventions
    6. Default Paths and File Names
    7. Acknowledgments
  6. Part I: Introduction
    1. 1. Overview
      1. 1.1 Java EE 7 Platform Highlights
      2. 1.2 Java EE Application Model
      3. 1.3 Distributed Multitiered Applications
      4. 1.4 Java EE Containers
      5. 1.5 Web Services Support
      6. 1.6 Java EE Application Assembly and Deployment
      7. 1.7 Development Roles
      8. 1.8 Java EE 7 APIs
      9. 1.9 Java EE 7 APIs in the Java Platform, Standard Edition 7
      10. 1.10 GlassFish Server Tools
    2. 2. Using the Tutorial Examples
      1. 2.1 Required Software
      2. 2.2 Starting and Stopping GlassFish Server
      3. 2.3 Starting the Administration Console
      4. 2.4 Starting and Stopping the Java DB Server
      5. 2.5 Building the Examples
      6. 2.6 Tutorial Example Directory Structure
      7. 2.7 Java EE 7 Maven Archetypes in the Tutorial
      8. 2.8 Getting the Latest Updates to the Tutorial
      9. 2.9 Debugging Java EE Applications
  7. Part II: Enterprise Beans
    1. 3. Enterprise Beans
      1. 3.1 What Is an Enterprise Bean?
      2. 3.2 What Is a Session Bean?
      3. 3.3 What Is a Message-Driven Bean?
      4. 3.4 Accessing Enterprise Beans
      5. 3.5 The Contents of an Enterprise Bean
      6. 3.6 Naming Conventions for Enterprise Beans
      7. 3.7 The Lifecycles of Enterprise Beans
      8. 3.8 Further Information about Enterprise Beans
    2. 4. Getting Started with Enterprise Beans
      1. 4.1 Creating the Enterprise Bean
      2. 4.2 Modifying the Java EE Application
    3. 5. Running the Enterprise Bean Examples
      1. 5.1 The cart Example
      2. 5.2 A Singleton Session Bean Example: counter
      3. 5.3 A Web Service Example: helloservice
      4. 5.4 Using the Timer Service
      5. 5.5 Handling Exceptions
    4. 6. Using the Embedded Enterprise Bean Container
      1. 6.1 Overview of the Embedded Enterprise Bean Container
      2. 6.2 Developing Embeddable Enterprise Bean Applications
      3. 6.3 The standalone Example Application
    5. 7. Using Asynchronous Method Invocation in Session Beans
      1. 7.1 Asynchronous Method Invocation
      2. 7.2 The async Example Application
  8. Part III: Persistence
    1. 8. Introduction to the Java Persistence API
      1. 8.1 Entities
      2. 8.2 Entity Inheritance
      3. 8.3 Managing Entities
      4. 8.4 Querying Entities
      5. 8.5 Database Schema Creation
      6. 8.6 Further Information about Persistence
    2. 9. Running the Persistence Examples
      1. 9.1 The order Application
      2. 9.2 The roster Application
      3. 9.3 The address-book Application
    3. 10. The Java Persistence Query Language
      1. 10.1 Query Language Terminology
      2. 10.2 Creating Queries Using the Java Persistence Query Language
      3. 10.3 Simplified Query Language Syntax
      4. 10.4 Example Queries
      5. 10.5 Full Query Language Syntax
    4. 11. Using the Criteria API to Create Queries
      1. 11.1 Overview of the Criteria and Metamodel APIs
      2. 11.2 Using the Metamodel API to Model Entity Classes
      3. 11.3 Using the Criteria API and Metamodel API to Create Basic Typesafe Queries
    5. 12. Creating and Using String-Based Criteria Queries
      1. 12.1 Overview of String-Based Criteria API Queries
      2. 12.2 Creating String-Based Queries
      3. 12.3 Executing String-Based Queries
    6. 13. Controlling Concurrent Access to Entity Data with Locking
      1. 13.1 Overview of Entity Locking and Concurrency
      2. 13.2 Lock Modes
    7. 14. Creating Fetch Plans with Entity Graphs
      1. 14.1 Entity Graph Basics
      2. 14.2 Using Named Entity Graphs
      3. 14.3 Using Entity Graphs in Query Operations
    8. 15. Using a Second-Level Cache with Java Persistence API Applications
      1. 15.1 Overview of the Second-Level Cache
      2. 15.2 Specifying the Cache Mode Settings to Improve Performance
  9. Part IV: Messaging
    1. 16. Java Message Service Concepts
      1. 16.1 Overview of the JMS API
      2. 16.2 Basic JMS API Concepts
      3. 16.3 The JMS API Programming Model
      4. 16.4 Using Advanced JMS Features
      5. 16.5 Using the JMS API in Java EE Applications
      6. 16.6 Further Information about JMS
    2. 17. Java Message Service Examples
      1. 17.1 Overview of the JMS Examples
      2. 17.2 Writing Simple JMS Applications
      3. 17.3 Writing More Advanced JMS Applications
      4. 17.4 Writing High Performance and Scalable JMS Applications
      5. 17.5 Sending and Receiving Messages Using a Simple Web Application
      6. 17.6 Receiving Messages Asynchronously Using a Message-Driven Bean
      7. 17.7 Sending Messages from a Session Bean to an MDB
      8. 17.8 Using an Entity to Join Messages from Two MDBs
      9. 17.9 Using NetBeans IDE to Create JMS Resources
  10. Part V: Security
    1. 18. Introduction to Security in the Java EE Platform
      1. 18.1 Overview of Java EE Security
      2. 18.2 Security Mechanisms
      3. 18.3 Securing Containers
      4. 18.4 Securing GlassFish Server
      5. 18.5 Working with Realms, Users, Groups, and Roles
      6. 18.6 Establishing a Secure Connection Using SSL
      7. 18.7 Further Information about Security
    2. 19. Getting Started Securing Web Applications
      1. 19.1 Overview of Web Application Security
      2. 19.2 Securing Web Applications
      3. 19.3 Using Programmatic Security with Web Applications
      4. 19.4 Examples: Securing Web Applications
    3. 20. Getting Started Securing Enterprise Applications
      1. 20.1 Basic Security Tasks for Enterprise Applications
      2. 20.2 Securing Enterprise Beans
      3. 20.3 Examples: Securing Enterprise Beans
    4. 21. Java EE Security: Advanced Topics
      1. 21.1 Working with Digital Certificates
      2. 21.2 Authentication Mechanisms
      3. 21.3 Using the JDBC Realm for User Authentication
      4. 21.4 Securing HTTP Resources
      5. 21.5 Securing Application Clients
      6. 21.6 Securing Enterprise Information Systems Applications
      7. 21.7 Configuring Security Using Deployment Descriptors
      8. 21.8 Further Information about Advanced Security Topics
  11. Part VI: Java EE Supporting Technologies
    1. 22. Transactions
      1. 22.1 Transactions in Java EE Applications
      2. 22.2 What Is a Transaction?
      3. 22.3 Container-Managed Transactions
      4. 22.4 Bean-Managed Transactions
      5. 22.5 Transaction Timeouts
      6. 22.6 Updating Multiple Databases
      7. 22.7 Transactions in Web Components
      8. 22.8 Further Information about Transactions
    2. 23. Resource Adapters and Contracts
      1. 23.1 What Is a Resource Adapter?
      2. 23.2 Metadata Annotations
      3. 23.3 Common Client Interface
      4. 23.4 Using Resource Adapters with Contexts and Dependency Injection for Java EE (CDI)
      5. 23.5 Further Information about Resource Adapters
    3. 24. The Resource Adapter Examples
      1. 24.1 The trading Example
      2. 24.2 The traffic Example
    4. 25. Using Java EE Interceptors
      1. 25.1 Overview of Interceptors
      2. 25.2 Using Interceptors
      3. 25.3 The interceptor Example Application
    5. 26. Batch Processing
      1. 26.1 Introduction to Batch Processing
      2. 26.2 Batch Processing in Java EE
      3. 26.3 Simple Use Case
      4. 26.4 Using the Job Specification Language
      5. 26.5 Creating Batch Artifacts
      6. 26.6 Submitting Jobs to the Batch Runtime
      7. 26.7 Packaging Batch Applications
      8. 26.8 The webserverlog Example Application
      9. 26.9 The phonebilling Example Application
      10. 26.10 Further Information about Batch Processing
    6. 27. Concurrency Utilities for Java EE
      1. 27.1 Concurrency Basics
      2. 27.2 Main Components of the Concurrency Utilities
      3. 27.3 Concurrency and Transactions
      4. 27.4 Concurrency and Security
      5. 27.5 The jobs Concurrency Example
      6. 27.6 The taskcreator Concurrency Example
      7. 27.7 Further Information about the Concurrency Utilities
  12. Part VII: Case Studies
    1. 28. Duke’s Bookstore Case Study Example
      1. 28.1 Design and Architecture of Duke’s Bookstore
      2. 28.2 The Duke’s Bookstore Interface
      3. 28.3 Running the Duke’s Bookstore Case Study Application
    2. 29. Duke’s Tutoring Case Study Example
      1. 29.1 Design and Architecture of Duke’s Tutoring
      2. 29.2 Main Interface
      3. 29.3 Administration Interface
      4. 29.4 Running the Duke’s Tutoring Case Study Application
    3. 30. Duke’s Forest Case Study Example
      1. 30.1 Design and Architecture of Duke’s Forest
      2. 30.2 Building and Deploying the Duke’s Forest Case Study Application
      3. 30.3 Running the Duke’s Forest Application
  13. Index