出版時(shí)間:2007-6 出版社:人民郵電出版社 作者:(德)鮑爾 頁(yè)數(shù):841
Tag標(biāo)簽:無
內(nèi)容概要
《Hibernate 實(shí)戰(zhàn)(第2版·英文版)》全面講述了Hibernate和Java Persistence,并對(duì)兩者進(jìn)行了詳細(xì)的對(duì)比分析。書中通過一個(gè)應(yīng)用將數(shù)百個(gè)例子融合起來,不僅深入剖析了Hibernate 3.2和Java Persistence 豐富的編程模型,還深刻闡述了數(shù)據(jù)庫(kù)設(shè)計(jì)、對(duì)象/關(guān)系映射(ORM)和優(yōu)化等方面的基本原則、策略和最佳實(shí)踐。書中處處閃爍著作者超凡的真知灼見,將大大升華讀者對(duì)ORM乃至企業(yè)級(jí)應(yīng)用開發(fā)的理解。
作者簡(jiǎn)介
Christian Bauer,是Hibernate核心開發(fā)人員,并負(fù)責(zé)維護(hù)Hibernate的文檔與網(wǎng)站。目前他是Red Hat公司JBoss部門負(fù)責(zé)Hibernate、EJB3.0和Seam的產(chǎn)品經(jīng)理。
書籍目錄
Part1 Getting started with Hibernate and EJB 3.01 Understanding object/relational persistence1.1 What is persistence? Relational databases Understanding SQL Using SQL in Java Persistence in object-oriented applications1.2 The paradigm mismatch The problem of granularity The problem of subtypes The problem of identity Problems relating to associations The problem of data navigation The cost of the mismatch1.3 Persistence layers and alternatives Layered architecture Hand-coding a persistence layer with SQL/JDBC Using serialization Object-oriented database systems Other options1.4 Object/relational mapping What is ORM? Generic ORM problems Why ORM? Introducing Hibernate, EJB3, and JPA1.5 Summary2 Starting a project2.1 Starting a Hibernate project Selecting a development process Setting up the project Hibernate configuration and startup Running and testing the application2.2 Starting a Java Persistence project Using Hibernate Annotations Using Hibernate EntityManager Introducing EJB components Switching to Hibernate interfaces2.3 Reverse engineering a legacy database Creating a database configuration Customizing reverse engineering Generating Java source code2.4 Integration with Java EE services Integration with JTA JNDI-bound SessionFactory JMX service deployment2.5 Summary3 Domain models and metadata3.1 The CaveatEmptor application Analyzing the business domain The CaveatEmptor domain model3.2 Implementing the domain model Addressing leakage of concerns Transparent and automated persistence Writing POJOs and persistent entity classes Implementing POJO associations Adding logic to accessor methods3.3 Object/relational mapping metadata Metadata in XML Annotation-based metadata Using XDoclet Handling global metadata Manipulating metadata at runtime3.4 Alternative entity representation Creating dynamic applications Representing data in XML3.5 SummaryPart 2 Mapping concepts and strategies4 Mapping persistent classes4.1 Understanding entities and value types Fine-grained domain models Defining the concept Identifying entities and value types4.2 Mapping entities with identity Understanding Java identity and equality Handling database identity Database primary keys4.3 Class mapping options Dynamic SQL generation Making an entity immutable Naming entities for querying Declaring a package name Quoting SQL identifiers Implementing naming conventions4.4 Fine-grained models and mappings Mapping basic properties Mapping components4.5 Summary5 Inheritance and custom types5.1 Mapping class inheritance Table per concrete class with implicit polymorphism Table per concrete class with unions Table per class hierarchy Table per subclass Mixing inheritance strategies Choosing a strategy5.2 The Hibernate type system Recapitulating entity and value types Built-in mapping types Using mapping types5.3 Creating custom mapping types Considering custom mapping types The extension points The case for custom mapping types Creating a UserType Creating a CompositeUserType Parameterizing custom types Mapping enumerations5.4 Summary6 Mapping collections and entity associations6.1 Sets, bags, lists, and maps of value types Selecting a collection interface Mapping a set Mapping an identifier bag Mapping a list Mapping a map Sorted and ordered collections6.2 Collections of components Writing the component class Mapping the collection Enabling bidirectional navigation Avoiding not-null columns6.3 Mapping collections with annotations Basic collection mapping Sorted and ordered collections Mapping a collection of embedded objects6.4 Mapping a parent/children relationship Multiplicity The simplest possible association Making the association bidirectional Cascading object state6.5 Summary7 Advanced entity association mappings7.1 Single-valued entity associations Shared primary key associations One-to-one foreign key associations Mapping with a join table7.2 Many-valued entity associations One-to-many associations Many-to-many associations Adding columns to join tables Mapping maps7.3 Polymorphic associations Polymorphic many-to-one associations Polymorphic collections Polymorphic associations to unions Polymorphic table per concrete class7.4 Summary8 Legacy databases and custom SQL8.1 Integrating legacy databases Handling primary keys Arbitrary join conditions with formulas Joining arbitrary tables Working with triggers8.2 Customizing SQL Writing custom CRUD statements Integrating stored procedures and functions8.3 Improving schema DDL Custom SQL names and datatypes Ensuring data consistency Adding domains and column constraints Table-level constraints Database constraints Creating indexes Adding auxiliary DDL8.4 SummaryPart 3 Conversational object processing9 Working with objects9.1 The persistence lifecycle Object states The persistence context9.2 Object identity and equality Introducing conversations The scope of object identity The identity of detached objects Extending a persistence context9.3 The Hibernate interfaces Storing and loading objects Working with detached objects Managing the persistence context9.4 The Java Persistence API Storing and loading objects Working with detached entity instances9.5 Using Java Persistence in EJB components Injecting an EntityManager Looking up an EntityManager Accessing an EntityManagerFactory9.6 Summary10 Transactions and concurrency10.1 Transaction essentials Database and system transactions Transactions in a Hibernate application Transactions with Java Persistence10.2 Controlling concurrent access Understanding database-level concurrency Optimistic concurrency control Obtaining additional isolation guarantees10.3 Nontransactional data access Debunking autocommit myths Working nontransactionally with Hibernate Optional transactions with JTA10.4 Summary11 Implementing conversations11.1 Propagating the Hibernate Session The use case for Session propagation Propagation through thread-local Propagation with JTA Propagation with EJBs11.2 Conversations with Hibernate Providing conversational guarantees Conversations with detached objects Extending a Session for a conversation11.3 Conversations with JPA Persistence context propagation in Java SE Merging detached objects in conversations Extending the persistence context in Java SE11.4 Conversations with EJB 3.0 Context propagation with EJBs Extended persistence contexts with EJBs11.5 Summary12 Modifying objects efficiently12.1 Transitive persistencePersistence by reachability Applying cascading to associations Working with transitive state Transitive associations with JPA12.2 Bulk and batch operations Bulk statements with HQL and JPA QL Processing with batches Using a stateless Session12.3 Data filtering and interception Dynamic data filters Intercepting Hibernate events The core event system Entity listeners and callbacks12.4 Summary13 Optimizing fetching and caching13.1 Defining the global fetch plan The object-retrieval options The lazy default fetch plan Understanding proxies Disabling proxy generation Eager loading of associations and collections Lazy loading with interception13.2 Selecting a fetch strategy Prefetching data in batches Prefetching collections with subselects Eager fetching with joins Optimizing fetching for secondary tables Optimization guidelines13.3 Caching fundamentals Caching strategies and scopes The Hibernate cache architecture13.4 Caching in practice Selecting a concurrency control strategy Understanding cache regions Setting up a local cache provider Setting up a replicated cache Controlling the second-level cache13.5 Summary14 Querying with HQL and JPA QL14.1 Creating and running queries Preparing a query Executing a query Using named queries14.2 Basic HQL and JPA QL queries Selection Restriction Projection14.3 Joins, reporting queries, and subselects Joining relations and associations Reporting queries Using subselects14.4 Summary15 Advanced query options15.1 Querying with criteria and example Basic criteria queries Joins and dynamic fetching Projection and report queries Query by example15.2 Using native SQL queries Automatic resultset handling Retrieving scalar values Native SQL in Java Persistence15.3 Filtering collections15.4 Caching query results Enabling the query result cache Understanding the query cache When to use the query cache Natural identifier cache lookups15.5 Summary16 Creating and testing layered applications16.1 Hibernate in a web application Introducing the use case Writing a controller The Open Session in View pattern Designing smart domain models16.2 Creating a persistence layer A generic data-access object pattern Implementing the generic CRUD interface Implementing entity DAOs Using data-access objects16.3 Introducing the Command pattern The basic interfaces Executing command objects Variations of the Command pattern16.4 Designing applications with EJB 3.0 Implementing a conversation with stateful beans Writing DAOs with EJBs Utilizing dependency injection16.5 Testing Understanding different kinds of tests Introducing TestNG Testing the persistence layer Considering performance benchmarks16.6 Summary17 Introducing JBoss Seam17.1 The Java EE 5.0 programming model Considering JavaServer Faces Considering EJB 3.0 Writing a web application with JSF and EJB 3.0 Analyzing the application17.2 Improving the application with Seam Configuring Seam Binding pages to stateful Seam components Analyzing the Seam application17.3 Understanding contextual components Writing the login page Creating the components Aliasing contextual variables Completing the login/logout feature17.4 Validating user input Introducing Hibernate Validator Creating the registration page Internationalization with Seam17.5 Simplifying persistence with Seam Implementing a conversation Letting Seam manage the persistence context17.6 Summaryappendix A SQL fundamentalsappendix B Mapping quick referencereferencesindex
編輯推薦
《Hibernate 實(shí)戰(zhàn)(第2版·英文版)》適合廣大的開發(fā)人員,從ORM的初學(xué)者到經(jīng)驗(yàn)豐富的開發(fā)人員。
圖書封面
圖書標(biāo)簽Tags
無
評(píng)論、評(píng)分、閱讀與下載
Hibernate實(shí)戰(zhàn) PDF格式下載