Hibernate in Action

by
Format: Paperback
Pub. Date: 2004-10-01
Publisher(s): Manning Pubns Co
List Price: $47.20

Rent Book

Select for Price
There was a problem. Please try again later.

New Book

We're Sorry
Sold Out

Used Book

We're Sorry
Sold Out

eBook

We're Sorry
Not Available

How Marketplace Works:

  • This item is offered by an independent seller and not shipped from our warehouse
  • Item details like edition and cover design may differ from our description; see seller's comments before ordering.
  • Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
  • Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
  • Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.

Summary

Both an introduction to the theoretical aspects of automated object/relational mapping and a practical guide to the use of Hibernate, this book provides extensive example code to implement an online auction application. The book is divided into two parts. Part I discusses object persistence, the object/relational mismatch problem and emphasizes the importance of Plain Old Java Objects. It introduces Hibernate and explains the basic theoretical foundations of object/relational mapping. Part II is dedicated to demonstrating more advanced ORM concepts and techniques, with practical examples using Hibernate. Hibernate's developer toolset is demonstrated and best practices are recommended.

Author Biography

Christian Bauer is a member of the Hibernate core developer team and maintains their Hibernate documentation and web site. Gavin King is the founder of the Hibernate project and a J2EE consultant.

Table of Contents

foreword xi
preface xiii
acknowledgments xv
about this book xvi
about Hibernate3 and EJB 3 xx
author online xxi
about the title and cover xxii
1 Understanding object/relational persistence 1(29)
1.1 What is persistence?
3(4)
Relational databases
3(1)
Understanding SQL
4(1)
Using SQL in Java
5(1)
Persistence in object-oriented applications
5(2)
1.2 The paradigm mismatch
7(9)
The problem of granularity
9(1)
The problem of subtypes
10(1)
The problem of identity
11(2)
Problems relating to associations
13(1)
The problem of object graph navigation
14(1)
The cost of the mismatch
15(1)
1.3 Persistence layers and alternatives
16(6)
Layered architecture
17(1)
Hand-coding a persistence layer with SQL/JDBC
18(1)
Using serialization
19(1)
Considering EJB entity beans
20(1)
Object-oriented database systems
21(1)
Other options
22(1)
1.4 Object/relational mapping
22(7)
What is ORM?
23(2)
Generic ORM problems
25(1)
Why ORM?
26(3)
1.5 Summary
29(1)
2 Introducing and integrating Hibernate 30(29)
2.1 "Hello World" with Hibernate
31(5)
2.2 Understanding the architecture
36(5)
The core interfaces
38(2)
Callback interfaces
40(1)
Types
40(1)
Extension interfaces
41(1)
2.3 Basic configuration
41(10)
Creating a SessionFactory
42(3)
Configuration in non-managed environments
45(3)
Configuration in managed environments
48(3)
2.4 Advanced configuration settings
51(7)
Using XML-based configuration
51(2)
JNDI-bound SessionFactory
53(1)
Logging
54(1)
Java Management Extensions ([MX)
55(3)
2.5 Summary
58(1)
3 Mapping persistent classes 59(55)
3.1 The CaveatEmptor application
60(4)
Analyzing the business domain
61(1)
The CaveatEmptor domain model
61(3)
3.2 Implementing the domain model
64(11)
Addressing leakage of concerns
64(1)
Transparent and automated persistence
65(2)
Writing POJOs
67(2)
Implementing POJO associations
69(4)
Adding logic to accessor methods
73(2)
3.3 Defining the mapping metadata
75(12)
Metadata in XML
75(3)
Basic property and class mappings
78(6)
Attribute-oriented programming
84(2)
Manipulating metadata at runtime
86(1)
3.4 Understanding object identity
87(5)
Identity versus equality
87(1)
Database identity with Hibernate
88(2)
Choosing primary keys
90(2)
3.5 Fine-grained object models
92(5)
Entity and value types
93(1)
Using components
93(4)
3.6 Mapping class inheritance
97(8)
Table per concrete class
97(2)
Table per class hierarchy
99(2)
Table per subclass
101(3)
Choosing a strategy
104(1)
3.7 Introducing associations
105(7)
Managed associations?
106(1)
Multiplicity
106(1)
The simplest possible association
107(1)
Making the association bidirectional
108(3)
A parent/child relationship
111(1)
3.8 Summary
112(2)
4 Working with persistent objects 114(40)
4.1 The persistence lifecycle
115(11)
Transient objects
116(1)
Persistent objects
117(1)
Detached objects
118(1)
The scope of object identity
119(2)
Outside the identity scope
121(1)
Implementing equals() and hashCode()
122(4)
4.2 The persistence manager
126(5)
Making an object persistent
126(1)
Updating the persistent state of a detached instance
127(2)
Retrieving a persistent object
129(1)
Updating a persistent object
129(1)
Making a persistent object transient
129(1)
Making a detached object transient
130(1)
4.3 Using transitive persistence in Hibernate
131(8)
Persistence by reachability
131(2)
Cascading persistence with Hibernate
133(1)
Managing auction categories
134(4)
Distinguishing between transient and detached instances
138(1)
4.4 Retrieving objects
139(13)
Retrieving objects by identifier
140(1)
Introducing HQL
141(1)
Query by criteria
142(1)
Query by example
143(1)
Fetching strategies
143(3)
Selecting a fetching strategy in mappings
146(5)
Tuning object retrieval
151(1)
4.5 Summary
152(2)
5 Transactions, concurrency, and caching 154(41)
5.1 Transactions, concurrency, and caching
154(2)
5.2 Understanding database transactions
156(12)
JDBC and JTA transactions
157(1)
The Hibernate Transaction API
158(2)
Flushing the Session
160(1)
Understanding isolation levels
161(2)
Choosing an isolation level
163(2)
Setting an isolation level
165(1)
Using pessimistic locking
165(3)
5.3 Working with application transactions
168(7)
Using managed versioning
169(3)
Granularity of a Session
172(2)
Other ways to implement optimistic locking
174(1)
5.4 Caching theory and practice
175(19)
Caching strategies and scopes
176(3)
The Hibernate cache architecture
179(6)
Caching in practice
185(9)
5.5 Summary
194(1)
6 Advanced mapping concepts 195(46)
6.1 Understanding the Hibernate type system
196(15)
Built-in mapping types
198(2)
Using mapping types
200(11)
6.2 Mapping collections of value types
211(9)
Sets, bags, lists, and maps
211(9)
6.3 Mapping entity associations
220(14)
One-to-one associations
220(5)
Many-to-many associations
225(9)
6.4 Mapping polymorphic associations
234(5)
Polymorphic many-to-one associations
234(2)
Polymorphic collections
236(1)
Polymorphic associations and table-perconcrete-class
237(2)
6.5 Summary
239(2)
7 Retrieving objects efficiently 241(53)
7.1 Executing queries
243(7)
The query interfaces
243(2)
Binding parameters
245(4)
Using named queries
249(1)
7.2 Basic queries for objects
250(8)
The simplest query
250(1)
Using aliases
251(1)
Polymorphic queries
251(1)
Restriction
252(1)
Comparison operators
253(2)
String matching
255(1)
Logical operators
256(1)
Ordering query results
257(1)
7.3 Joining associations
258(11)
Hibernate join options
259(1)
Fetching associations
260(2)
Using aliases with joins
262(3)
Using implicit joins
265(2)
Theta-style joins
267(1)
Comparing identifiers
268(1)
7.4 Writing report queries
269(7)
Projection
270(2)
Using aggregation
272(1)
Grouping
273(1)
Restricting groups with having
274(1)
Improving performance with report queries
275(1)
7.5 Advanced query techniques
276(10)
Dynamic queries
276(3)
Collection filters
279(2)
Subqueries
281(2)
Native SQL queries
283(3)
7.6 Optimizing object retrieval
286(6)
Solving the n+l selects problem
286(3)
Using iterate() queries
289(1)
Caching queries
290(2)
7.7 Summary
292(2)
8 Writing Hibernate applications 294(54)
8.1 Designing layered applications
295(25)
Using Hibernate in a serolet engine
296(15)
Using Hibernate in an EJB container
311(9)
8.2 Implementing application transactions
320(10)
Approving a new auction
321(1)
Doing it the hard way
322(2)
Using detached persistent objects
324(1)
Using a long session
325(4)
Choosing an approach to application transactions
329(1)
8.3 Handling special kinds of data
330(17)
Legacy schemas and composite keys
330(10)
Audit logging
340(7)
8.4 Summary
347(1)
9 Using the toolset 348(30)
9.1 Development processes
349(2)
Top down
350(1)
Bottom up
350(1)
Middle out (metadata oriented)
350(1)
Meet in the middle
350(1)
Roundtripping
351(1)
9.2 Automatic schema generation
351(7)
Preparing the mapping metadata
352(3)
Creating the schema
355(2)
Updating the schema
357(1)
9.3 Generating POJO code
358(6)
Adding meta-attributes
358(2)
Generating finders
360(2)
Configuring hbm2java
362(1)
Running hbm2java
363(1)
9.4 Existing schemas and Middlegen
364(8)
Starting Middlegen
364(2)
Restricting tables and relationships
366(2)
Customizing the metadata generation
368(2)
Generating hbm2java and XDoclet metadata
370(2)
9.5 XDoclet
372(4)
Setting value type attributes
372(2)
Mapping entity associations
374(1)
Running XDoclet
375(1)
9.6 Summary
376(2)
appendix A: SQL fundamentals 378(4)
appendix B: ORM implementation strategies 382(6)
B.1 Properties or fields?
383(1)
B.2 Dirty-checking strategies
384(4)
appendix C: Back in the real world 388(7)
C.1 The strange copy
389(1)
C.2 The more the better
390(1)
C.3 We don't need primary keys
390(1)
C.4 Time isn't linear
391(1)
C.5 Dynamically unsafe
391(1)
C.6 To synchronize or not?
392(1)
C.7 Really fat client
393(1)
C.8 Resuming Hibernate
394(1)
references 395(2)
index 397

An electronic version of this book is available through VitalSource.

This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.

By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.

Digital License

You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.

More details can be found here.

A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.

Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.

Please view the compatibility matrix prior to purchase.