The Java EE 6 Tutorial
Advanced Topics
Fourth Edition
Eric Jendrock
Ricardo Cervera-Navarro
Ian Evans
Devika Gollapudi
Kim Haase
William Markito
Chinmayee Srivathsa
Upper Saddle River, NJ Boston Indianapolis San Francisco
New York Toronto Montreal London Munich Paris Madrid
Capetown Sydney Tokyo Singapore Mexico City
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
The authors and publisher have taken care in the preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs contained herein.
This document is provided for information purposes only and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact
U.S. Corporate and Government Sales
(800) 382-3419
For sales outside the United States, please contact
International Sales
Visit us on the Web: informit.com/aw
Library of Congress Control Number: 2012952541
Copyright 2011, 2013, Oracle and/or its affiliates. All rights reserved.
500 Oracle Parkway, Redwood Shores, CA 94065
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to (201) 236-3290.
ISBN-13: 978-0-13-708186-8
ISBN-10: 0-13-708186-3
Text printed in the United States on recycled paper at RR Donnelley in Crawfordsville, Indiana.
First printing, January, 2013
Preface
This tutorial is the second volume of a guide to developing enterprise applications for the Java Platform, Enterprise Edition 6 (Java EE 6) using GlassFish Server Open Source Edition.
Oracle GlassFish Server, a Java EE compatible application server, is based on GlassFish Server Open Source Edition, the leading open-source and open-community platform for building and deploying next-generation applications and services. GlassFish Server Open Source Edition, developed by the GlassFish project open-source community at http://glassfish.java.net/
, is the first compatible implementation of the Java EE 6 platform specification. This lightweight, flexible, and open-source application server enables organizations not only to leverage the new capabilities introduced within the Java EE 6 specification, but also to add to their existing capabilities through a faster and more streamlined development and deployment cycle. Oracle GlassFish Server, the product version, and GlassFish Server Open Source Edition, the open-source version, are hereafter referred to as GlassFish Server.
Before You Read This Book
Before proceeding with this book, you should be familiar with Volume One of this tutorial, The Java EE 6 Tutorial: Basic Concepts. Both volumes assume that you have a good knowledge of the Java programming language. A good way to get to that point is to read the Java Tutorials, available at http://docs.oracle.com/javase/
.
Related Documentation
The GlassFish Server documentation set describes deployment planning and system installation. To obtain documentation for GlassFish Server Open Source Edition, go to http://glassfish.java.net/docs/
. The Uniform Resource Locator (URL) for the Oracle GlassFish Server product documentation is http://docs.oracle.com/cd/E26576_01/index.htm
.
Javadoc tool reference documentation for packages that are provided with GlassFish Server is available as follows.
The API specification for version 6 of Java EE is located at http://docs.oracle.com/javaee/6/api/
.
The API specification for GlassFish Server, including Java EE 6 platform packages and nonplatform packages that are specific to the GlassFish Server product, is located at http://glassfish.java.net/nonav/docs/v3/api/
.
Additionally, the Java EE Specifications at http://www.oracle.com/technetwork/java/javaee/tech/index.html
might be useful.
For information about creating enterprise applications in the NetBeans Integrated Development Environment (IDE), see http://www.netbeans.org/kb/
.
For information about the Java DB database for use with the GlassFish Server, see http://www.oracle.com/technetwork/java/javadb/overview/index.html
.
The GlassFish Samples project is a collection of sample applications that demonstrate a broad range of Java EE technologies. The GlassFish Samples are bundled with the Java EE Software Development Kit (SDK) and are also available from the GlassFish Samples project page at http://glassfish-samples.java.net/
.
Typographic Conventions
describes the typographic changes that are used in this book.
TABLE P1. Typographic Conventions
Default Paths and File Names
describes the default paths and file names that are used in this book.
TABLE P2. Default Paths and File Names
Third-Party Web Site References
Third-party URLs are referenced in this document and provide additional, related information.
Note
Oracle is not responsible for the availability of third-party web sites mentioned in this document. Oracle does not endorse and is not responsible or liable for any content, advertising, products, or other materials that are available on or through such sites or resources. Oracle will not be responsible or liable for any actual or alleged damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods, or services that are available on or through such sites or resources.