[JAVA][Beginning Hibernate From Novice to Professional].pdf

(2540 KB) Pobierz
5584339 UNPDF
THE EXPERT’S VOICE ® IN JAVA TECHNOLOGY
Covers
Hibernate 3.2
Hibernate
From Novice to Professional
An introduction to all the new features
of the Hibernate 3.2 persistence API
Dave Minter and Jeff Linwood
Beginning
5584339.039.png 5584339.049.png 5584339.057.png 5584339.065.png 5584339.001.png 5584339.002.png 5584339.003.png 5584339.004.png 5584339.005.png 5584339.006.png 5584339.007.png 5584339.008.png 5584339.009.png 5584339.010.png 5584339.011.png 5584339.012.png 5584339.013.png 5584339.014.png 5584339.015.png 5584339.016.png 5584339.017.png 5584339.018.png 5584339.019.png 5584339.020.png 5584339.021.png 5584339.022.png 5584339.023.png 5584339.024.png 5584339.025.png
 
5584339.026.png
 
5584339.027.png
 
5584339.028.png
 
5584339.029.png
 
5584339.030.png 5584339.031.png 5584339.032.png 5584339.033.png 5584339.034.png 5584339.035.png 5584339.036.png 5584339.037.png 5584339.038.png 5584339.040.png 5584339.041.png
 
5584339.042.png 5584339.043.png 5584339.044.png 5584339.045.png 5584339.046.png 5584339.047.png 5584339.048.png 5584339.050.png 5584339.051.png 5584339.052.png 5584339.053.png 5584339.054.png 5584339.055.png 5584339.056.png 5584339.058.png 5584339.059.png 5584339.060.png 5584339.061.png 5584339.062.png 5584339.063.png 5584339.064.png 5584339.066.png 5584339.067.png 5584339.068.png
Beginning
Hibernate
From Novice to
Professional
Dave Minter and
Jeff Linwood
5584339.069.png 5584339.070.png 5584339.071.png
Beginning Hibernate: From Novice to Professional
Copyright © 2006 by Dave Minter, Jeff Linwood
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-59059-693-7
ISBN-10 (pbk): 1-59059-693-5
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the
US and other countries.
Apress, Inc. is not affiliated with Sun Microsystems, Inc., and this book was written without endorsement
from Sun Microsystems, Inc.
Lead Editor: Steve Anglin
Technical Reviewer: Sumit Pal
Editorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Jason Gilmore, Jonathan Gennick,
Jonathan Hassell, James Huddleston, Chris Mills, Matthew Moodie, Dominic Shakeshaft, Jim Sumser,
Keir Thomas, Matt Wade
Senior Project Manager: Kylie Johnston
Copy Edit Manager: Nicole LeClerc
Copy Editor: Damon Larson
Assistant Production Director: Kari Brooks-Copony
Senior Production Editor: Laura Cheu
Compositor: Linda Weidemann, Wolf Creek Press
Proofreader: April Eddy
Indexer: Michael Brinkman
Artist: April Milne
Cover Designer: Kurt Krames
Manufacturing Director: Tom Debolski
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com ,
or visit http://www.springeronline.com .
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley,
CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com , or visit http://www.apress.com .
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to
any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly
by the information contained in this work.
The source code for this book is available to readers at http://www.apress.com in the Source Code section.
5584339.072.png
Contents at a Glance
About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii
About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix
n CHAPTER 1 An Introduction to Hibernate 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
n CHAPTER 2 Integrating and Configuring Hibernate . . . . . . . . . . . . . . . . . . . . . . . . . . 11
n CHAPTER 3 Building a Simple Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
n CHAPTER 4 The Persistence Life Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
n CHAPTER 5 An Overview of Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
n CHAPTER 6 Mapping with Annotations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
n CHAPTER 7 Creating Mappings with Hibernate XML Files . . . . . . . . . . . . . . . . . . 139
n CHAPTER 8 Using the Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
n CHAPTER 9 Searches and Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
n CHAPTER 10 Advanced Queries Using Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
n CHAPTER 11 Filtering the Results of Searches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
n APPENDIX A More Advanced Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
n APPENDIX B Hibernate Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
n APPENDIX C Hibernate and Spring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
n APPENDIX D Upgrading from Hibernate 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
n INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
iii
5584339.073.png
5584339.074.png
Zgłoś jeśli naruszono regulamin