Document Information

Preface

Part I Introduction

1.  Overview

2.  Using the Tutorial Examples

Part II The Web Tier

3.  Getting Started with Web Applications

4.  Java Servlet Technology

5.  JavaServer Faces Technology

6.  Introduction to Facelets

7.  Using JavaServer Faces Technology in Web Pages

8.  Developing with JavaServer Faces Technology

9.  Configuring JavaServer Faces Applications

Part III Web Services

10.  Introduction to Web Services

11.  Building Web Services with JAX-WS

12.  Building RESTful Web Services with JAX-RS and Jersey

Part IV Enterprise Beans

13.  Enterprise Beans

14.  Getting Started with Enterprise Beans

15.  Running the Enterprise Bean Examples

Part V Persistence

16.  Introduction to the Java Persistence API

The order Application

Entity Relationships in the order Application

Self-Referential Relationships

One-to-One Relationships

One-to-Many Relationship Mapped to Overlapping Primary and Foreign Keys

Unidirectional Relationships

Primary Keys in the order Application

Generated Primary Keys

Compound Primary Keys

Entity Mapped to More Than One Database Table

Cascade Operations in the order Application

BLOB and CLOB Database Types in the order Application

Temporal Types in the order Application

Managing the order Application's Entities

Creating Entities

Finding Entities

Setting Entity Relationships

Using Queries

Removing Entities

Building and Running the order Application

Building, Packaging, Deploying, and Running order In NetBeans IDE

Building, Packaging, Deploying, and Running order Using Ant

The roster Application

Relationships in the roster Application

The Many-To-Many Relationship in roster

Entity Inheritance in the roster Application

Automatic Table Generation in the roster Application

Building and Running the roster Application

Building, Packaging, Deploying, and Running roster in NetBeans IDE

Building, Packaging, Deploying, and Running roster Using Ant

Accessing Databases from Web Applications

Defining the Persistence Unit

Creating an Entity Class

Obtaining Access to an Entity Manager

Accessing Data from the Database

Updating Data in the Database

18.  The Java Persistence Query Language

Part VI Security

19.  Introduction to Security in the Java EE Platform

20.  Using Java EE Security

21.  Securing Java EE Applications

22.  Securing Web Applications

Part VII Java EE Supporting Technologies

23.  Introduction to Java EE Supporting Technologies

24.  Transactions

25.  Resource Connections

Index

 

Chapter 17

Running the Persistence Examples

This chapter describes how to use the Java Persistence API in different example applications. The material here focuses on the source code and settings of three examples. The first example called order is an application that uses a stateful session bean to manage entities related to an ordering system. The second example is roster, an application that manages a community sports system. The third example is a version of the bookstore web application that shows how to use application-managed transactions when using the Java Persistence API. This chapter assumes that you are familiar with the concepts detailed in Chapter 16, Introduction to the Java Persistence API.