Java Persistence with Hibernate is the new bible of Hibernate. As a major revision of the popular Hibernate in Action, it builds on the same single example application to introduce and explain the latest Hibernate 3.2 in detail. In addition, the new and significantly improved EJB 3.0 Java Persistencava persistencewith hibernateSECOND EDITIONCHRISTIAN BAUERGAVIN KINGGARY GREGORYMANNINGSHELTER ISLANDFor online information and ordering of this and other Manning books, please visitwww.manning.com.thepublisheroffersdiscountsonthisbookwhenorderedinquantityFor more information, please contactSpecial sales departmentManning publicC20 Baldwin roadPO BoX 761Shelter island. ny 11964Email:orders@manning.com@2016 by Manning Publications Co. All rights reservedNo part of this publication may be reproduced, stored in a retrieval system, or transmitted, inany form or by means electronic, mechanical, photocopying, or otherwise, without prior writtenpermission of the publisher:Many of the designations used by manufacturers and sellers to distinguish their products areclaimed as trademarks. Where those designations appear in the book, and manningPublications was aware of a trademark claim, the designations have been printed in initial capsor all capo Recognizing the importance of preserving what has been written, it is Manning,'s policy to havethe books we publish printed on acid-free paper, and we exert our best efforts to that endRecognizing also our responsibility to conserve the resources of our planet, Manning bookare printed on paper that is at least 15 percent recycled and processed without the use ofelemental chlorineManning Publications CoDevelopment editor: Christina Taylor20 Baldwin roadTechnical development editor: Palak mathurPO Box 761opyeaitorTiffany taylorShelter island.nY 11964Proofreaders: Katie Tennant. Barbara MireckiTechnical proofreader: Christian AlfanoTypesetter: Dottie marsicoCover designer: Marija TudorISBN9781617290459Printed in the united states of america12345678910-EBM-201918171615To Alexander, for teaching me how to teach himGGbrief contentsPART1 GETTING STARTED WITH ORM。。n1 Understanding object/relational persistence 32 Starting a project 193Domain models and metadata 30PART 2 MAPPING STRATEGIES......594 Mapping persistent classes 61Mapping value types 816 Mapping inheritance 1177 Mapping collections and entity associations 1408 Advanced entity association mappings 1729 Complex and legacy schemas 203PART 3 TRANSACTIONAL DATA PROCESSING.........22710 Managing data 229Transactions and concurrency 25412 Fetch plans, strategies and profiles 28318 Filtering data 312BRIEF CONTENTSPART 4 WRITING QUERIES14-Creating and executing queries34515The query languages 36916 Advanced query options 4087 Customizing SQL 426PART 5 BUILDING APPLICATIONS ..........9.4.46918 Designing client/server applications 47119Building web applications 49820 Scaling Hibernate 532contentsforeword to the first edition xixpreface xxiacknowledgments xxiiiabout this book xxiabout the cover illustration xxxiiPARTI GETTING STARTED WITH ORMUnderstanding object/relational persistence 31.1 What is persistence? 4Relational databases 5. Understanding SQL 6Using SQL in Java 61. 2 The paradigm mismatch 8The problem of granularity 10. The problem of subtypes 11The problem of identity 12 Problems relating to associations 14The problem of data navigation 151. 3 ORM andJPA 161.4 Summary 182 Starting a project 192.1 Introducing Hibernate 19