Home > Store

Java EE 7 Tutorial, The: Volume 2, 5th Edition

Register your product to gain access to bonus material or receive a coupon.

Java EE 7 Tutorial, The: Volume 2, 5th Edition

eBook (Watermarked)

  • Your Price: $38.39
  • List Price: $47.99
  • About Watermarked eBooks
  • This PDF will be accessible from your Account page after purchase and requires PDF reading software, such as Acrobat® Reader®.

    The eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

    Watermarked eBook FAQ


  • Copyright 2014
  • Dimensions: 7-1/2" x 9-1/8"
  • Edition: 5th
  • eBook (Watermarked)
  • ISBN-10: 0-13-390164-5
  • ISBN-13: 978-0-13-390164-1

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.

Sample Content

Table of Contents

Preface           xxxi

Part I: Introduction            1

Chapter 1: Overview         3

1.1 Java EE 7 Platform Highlights   4

1.2 Java EE Application Model   5

1.3 Distributed Multitiered Applications   6

1.4 Java EE Containers   13

1.5 Web Services Support   15

1.6 Java EE Application Assembly and Deployment   17

1.7 Development Roles   17

1.8 Java EE 7 APIs   20

1.9 Java EE 7 APIs in the Java Platform, Standard Edition 7    30

1.10 GlassFish Server Tools   33

Chapter 2: Using the Tutorial Examples            35

2.1 Required Software   35

2.2 Starting and Stopping GlassFish Server    39

2.3 Starting the Administration Console   40

2.4 Starting and Stopping the Java DB Server   40

2.5 Building the Examples   41

2.6 Tutorial Example Directory Structure   41

2.7 Java EE 7 Maven Archetypes in the Tutorial   42

2.8 Getting the Latest Updates to the Tutorial   43

2.9 Debugging Java EE Applications    44

Part II: Enterprise Beans           47

Chapter 3: Enterprise Beans            49

3.1 What Is an Enterprise Bean?   49

3.2 What Is a Session Bean?    51

3.3 What Is a Message-Driven Bean?   53

3.4 Accessing Enterprise Beans   55

3.5 The Contents of an Enterprise Bean    62

3.6 Naming Conventions for Enterprise Beans   63

3.7 The Lifecycles of Enterprise Beans    63

3.8 Further Information about Enterprise Beans    66

Chapter 4: Getting Started with Enterprise Beans           67

4.1 Creating the Enterprise Bean   68

4.2 Modifying the Java EE Application   71

Chapter 5: Running the Enterprise Bean Examples            73

5.1 The cart Example   73

5.2 A Singleton Session Bean Example: counter    81

5.3 A Web Service Example: helloservice   89

5.4 Using the Timer Service   92

5.5 Handling Exceptions   104

Chapter 6: Using the Embedded Enterprise Bean Container              105

6.1 Overview of the Embedded Enterprise Bean Container    105

6.2 Developing Embeddable Enterprise Bean Applications   106

6.3 The standalone Example Application    109

Chapter 7: Using Asynchronous Method Invocation in Session Beans              113

7.1 Asynchronous Method Invocation    113

7.2 The async Example Application    116

Part III: Persistence             121

Chapter 8: Introduction to the Java Persistence API              123

8.1 Entities    123

8.2 Entity Inheritance    136

8.3 Managing Entities   141

8.4 Querying Entities   146

8.5 Database Schema Creation   147

8.6 Further Information about Persistence   150

Chapter 9: Running the Persistence Examples            151

9.1 The order Application   151

9.2 The roster Application   165

9.3 The address-book Application    174

Chapter 10: The Java Persistence Query Language                 179

10.1 Query Language Terminology   180

10.2 Creating Queries Using the Java Persistence Query Language   180

10.3 Simplified Query Language Syntax   182

10.4 Example Queries   183

10.5 Full Query Language Syntax   189

Chapter 11: Using the Criteria API to Create Queries                215

11.1 Overview of the Criteria and Metamodel APIs   215

11.2 Using the Metamodel API to Model Entity Classes   217

11.3 Using the Criteria API and Metamodel API to Create Basic Typesafe Queries   219

Chapter 12: Creating and Using String-Based Criteria Queries                227

12.1 Overview of String-Based Criteria API Queries    227

12.2 Creating String-Based Queries    228

12.3 Executing String-Based Queries    229

Chapter 13: Controlling Concurrent Access to Entity Data with Locking          231

13.1 Overview of Entity Locking and Concurrency    231

13.2 Lock Modes   233

Chapter 14: Creating Fetch Plans with Entity Graphs              237

14.1 Entity Graph Basics   238

14.2 Using Named Entity Graphs   240

14.3 Using Entity Graphs in Query Operations    241

Chapter 15: Using a Second-Level Cache with Java Persistence API Applications           243

15.1 Overview of the Second-Level Cache   243

15.2 Specifying the Cache Mode Settings to Improve Performance   245

Part IV: Messaging           251

Chapter 16: Java Message Service Concepts                253

16.1 Overview of the JMS API   253

16.2 Basic JMS API Concepts   257

16.3 The JMS API Programming Model   260

16.4 Using Advanced JMS Features    278

16.5 Using the JMS API in Java EE Applications    287

16.6 Further Information about JMS    298

Chapter 17: Java Message Service Examples              299

17.1 Overview of the JMS Examples   300

17.2 Writing Simple JMS Applications   301

17.3 Writing More Advanced JMS Applications   319

17.4 Writing High Performance and Scalable JMS Applications   328

17.5 Sending and Receiving Messages Using a Simple Web Application   332

17.6 Receiving Messages Asynchronously Using a Message-Driven Bean    336

17.7 Sending Messages from a Session Bean to an MDB    341

17.8 Using an Entity to Join Messages from Two MDBs    346

17.9 Using NetBeans IDE to Create JMS Resources   354

Part V: Security             357

Chapter 18: Introduction to Security in the Java EE Platform            359

18.1 Overview of Java EE Security   360

18.2 Security Mechanisms   365

18.3 Securing Containers   369

18.4 Securing GlassFish Server   370

18.5 Working with Realms, Users, Groups, and Roles   371

18.6 Establishing a Secure Connection Using SSL    379

18.7 Further Information about Security   381

Chapter 19: Getting Started Securing Web Applications                   383

19.1 Overview of Web Application Security    384

19.2 Securing Web Applications   385

19.3 Using Programmatic Security with Web Applications   395

19.4 Examples: Securing Web Applications   401

Chapter 20: Getting Started Securing Enterprise Applications                   411

20.1 Basic Security Tasks for Enterprise Applications   411

20.2 Securing Enterprise Beans    412

20.3 Examples: Securing Enterprise Beans    422

Chapter 21: Java EE Security: Advanced Topics               431

21.1 Working with Digital Certificates    431

21.2 Authentication Mechanisms    436

21.3 Using the JDBC Realm for User Authentication   441

21.4 Securing HTTP Resources    443

21.5 Securing Application Clients    446

21.6 Securing Enterprise Information Systems Applications   448

21.7 Configuring Security Using Deployment Descriptors   451

21.8 Further Information about Advanced Security Topics   453

Part VI: Java EE Supporting Technologies            455

Chapter 22: Transactions              457

22.1 Transactions in Java EE Applications    458

22.2 What Is a Transaction    458

22.3 Container-Managed Transactions    459

22.4 Bean-Managed Transactions    465

22.5 Transaction Timeouts    467

22.6 Updating Multiple Databases    467

22.7 Transactions in Web Components   468

22.8 Further Information about Transactions    469

Chapter 23: Resource Adapters and Contracts             471

23.1 What Is a Resource Adapter?    471

23.2 Metadata Annotations   475

23.3 Common Client Interface   477

23.4 Using Resource Adapters with Contexts and Dependency Injection for

Java EE (CDI)    478

23.5 Further Information about Resource Adapters    479

Chapter 24: The Resource Adapter Examples           481

24.1 The trading Example    481

24.2 The traffic Example    488

Chapter 25: Using Java EE Interceptors          497

25.1 Overview of Interceptors    497

25.2 Using Interceptors    499

25.3 The interceptor Example Application    507

Chapter 26: Batch Processing                  511

26.1 Introduction to Batch Processing    512

26.2 Batch Processing in Java EE   516

26.3 Simple Use Case    519

26.4 Using the Job Specification Language   523

26.5 Creating Batch Artifacts    533

26.6 Submitting Jobs to the Batch Runtime    539

26.7 Packaging Batch Applications   540

26.8 The webserverlog Example Application    541

26.9 The phonebilling Example Application    548

26.10 Further Information about Batch Processing   557

Chapter 27: Concurrency Utilities for Java EE               559

27.1 Concurrency Basics    559

27.2 Main Components of the Concurrency Utilities    560

27.3 Concurrency and Transactions   561

27.4 Concurrency and Security    562

27.5 The jobs Concurrency Example   562

27.6 The taskcreator Concurrency Example    567

27.7 Further Information about the Concurrency Utilities    570

Part VII: Case Studies            571

Chapter 28: Duke's Bookstore Case Study Example           573

28.1 Design and Architecture of Duke’s Bookstore   573

28.2 The Duke’s Bookstore Interface   575

28.3 Running the Duke’s Bookstore Case Study Application    580

Chapter 29: Duke’s Tutoring Case Study Example             583

29.1 Design and Architecture of Duke's Tutoring   583

29.2 Main Interface   585

29.3 Administration Interface   590

29.4 Running the Duke's Tutoring Case Study Application    592

Chapter 30: Duke’s Forest Case Study Example          595

30.1 Design and Architecture of Duke's Forest   596

30.2 Building and Deploying the Duke's Forest Case Study Application   610

30.3 Running the Duke's Forest Application    611

Index                615


Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020