𝔖 Scriptorium
✦   LIBER   ✦

📁

Beginning Hibernate, 2nd Edition

✍ Scribed by Jeff Linwood, Dave Minter


Publisher
Apress
Year
2010
Tongue
English
Leaves
401
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


Beginning Hibernate, Second Edition is ideal if you’re experienced in Java with databases (the traditional, or ''connected,'' approach), but new to open source, lightweight Hibernate—the de facto object-relational mapping and database-oriented application development framework.This book packs in brand-new information about the latest release of the Hibernate 3.5 persistence layer and provides a clear introduction to the current standard for object-relational persistence in Java. And since the book keeps its focus on Hibernate without wasting time on nonessential third-party tools, you’ll be able to immediately start building transaction-based engines and applications.Experienced authors Dave Minter and Jeff Linwood provide more in-depth examples than any other book for Hibernate beginners. The authors also present material in a lively, example-based manner—not a dry, theoretical, hard-to-read fashion.What you’ll learnHow to build enterprise Java-based transaction—type applications that access complex data with Hibernate, including Software as a Service (SaaS)How to work with Hibernate 3.5Where to integrate into the persistence lifecycle, including cloud application implicationsHow to map using annotations, Hibernate XML files, and moreHow to search and query with the new version of HibernateWhen to integrate with Spring, Grails, and moreWho this book is forThis book is for Java developers who want to learn about Hibernate

✦ Table of Contents


Prelim......Page 1
Contents at a Glance......Page 5
Contents......Page 7
About the Authors......Page 17
About the Technical Reviewer......Page 18
Acknowledgments......Page 19
How This Book Is Structured......Page 20
Contacting the Authors......Page 22
Plain Old Java Objects (POJOs)......Page 23
Origins of Hibernate and Object-Relational Mapping......Page 25
Hibernate As a Persistence Solution......Page 26
A Hibernate Hello World Example......Page 27
Mappings......Page 28
Summary......Page 29
The Steps Needed to Integrate and Configure Hibernate......Page 31
Understanding Where Hibernate Fits in Your Java Application......Page 32
Required Libraries for Running Hibernate 3.5......Page 33
Hibernate Configuration......Page 34
Hibernate Properties......Page 36
XML Configuration......Page 40
Annotated Classes......Page 41
Naming Strategy......Page 42
The Session Factory......Page 43
SQL Dialects......Page 44
Summary......Page 47
Hibernate and Hibernate Tools......Page 49
HSQLDB 2.0.0......Page 50
Ant 1.8.0......Page 51
The Ant Tasks......Page 54
Creating a Hibernate Configuration File......Page 55
Running the Message Example......Page 57
Persisting Multiple Objects......Page 60
Creating Persistence Classes......Page 61
Creating the Object Mappings......Page 64
Creating the Tables......Page 70
The Session and Related Objects......Page 72
Using the Session......Page 74
The Example Client......Page 76
Summary......Page 81
Introduction to the Life Cycle......Page 83
Entities, Classes, and Names......Page 84
Entities and Associations......Page 85
Saving Entities......Page 89
Object Equality and Identity......Page 90
Loading Entities......Page 91
Refreshing Entities......Page 92
Updating Entities......Page 93
Cascading Operations......Page 94
Lazy Loading, Proxies, and Collection Wrappers......Page 96
Summary......Page 97
An Overview of Mapping......Page 99
Why Mapping Cannot Be Automated......Page 100
Primary Keys......Page 102
Associations......Page 104
The One-to-One Association......Page 106
The One-to-Many and Many-to-One Association......Page 108
The Many-to-Many Association......Page 110
The Mapping of Inheritance Relationships to the Database......Page 111
Summary......Page 112
Pros of Annotations......Page 113
JPA 2 Persistence Annotations......Page 115
Primary Keys with @Id and @GeneratedValue......Page 117
Generating Primary Key Values with @SequenceGenerator......Page 119
Generating Primary Key Values with @TableGenerator......Page 120
Compound Primary Keys with @Id, @IdClass, or @EmbeddedId......Page 121
Database Table Mapping with @Table and @SecondaryTable......Page 125
Omitting Persistence with @Transient......Page 127
Mapping Properties and Fields with @Column......Page 128
Mapping an Embedded (Component) One-to-One Association......Page 129
Mapping a Conventional One-to-One Association......Page 130
Mapping a Many-to-One or One-to-Many Association......Page 131
Mapping a Many-to-Many Association......Page 135
Inheritance......Page 136
Single Table......Page 137
Table per Class......Page 138
Temporal Data......Page 139
Large Objects......Page 140
Ordering Collections with @OrderColumn......Page 141
Named Queries (HQL or JPQL)......Page 142
Configuring the Annotated Classes......Page 143
Hibernate 3–Specific Persistence Annotations......Page 144
Sorting Collections with @Sort......Page 145
Alternative Key Generation Strategies with @GenericGenerator......Page 146
Using Ant with Annotation-Based Mappings......Page 147
Code Listings......Page 148
Summary......Page 153
Entities......Page 155
Values......Page 156
The Element......Page 158
The Element......Page 160
The Element......Page 163
The Element......Page 166
The Element......Page 168
The Element......Page 169
The Element......Page 171
The Collection Elements......Page 174
The set Collection......Page 176
The list Collection......Page 178
The idbag Collection......Page 179
The map Collection......Page 180
The bag Collection......Page 181
Mapping Simple Classes......Page 182
Mapping Composition......Page 184
Mapping Other Associations......Page 187
Mapping Collections......Page 190
One Table per Concrete Class......Page 193
One Table per Subclass......Page 194
One Table per Class Hierarchy......Page 196
The any Tag......Page 197
Summary......Page 198
Sessions......Page 199
Transactions......Page 203
Locking......Page 206
Deadlocks......Page 207
Caching......Page 211
Threads......Page 213
Summary......Page 214
Hibernate Query Language (HQL)......Page 215
DELETE......Page 216
SELECT......Page 217
The First Example with HQL......Page 218
Logging the SQL......Page 222
Commenting the Generated SQL......Page 223
The select Clause and Projection......Page 224
Using Restrictions with HQL......Page 225
Using Named Parameters......Page 226
Obtaining a Unique Result......Page 227
Associations......Page 228
Aggregate Methods......Page 229
Bulk Updates and Deletes with HQL......Page 230
Named Queries for HQL and SQL......Page 231
Using Native SQL......Page 233
Summary......Page 235
Using Restrictions with Criteria......Page 237
Obtaining a Unique Result......Page 241
Associations......Page 242
Projections and Aggregates......Page 243
Query By Example (QBE)......Page 245
Summary......Page 247
When to Use Filters......Page 249
Filters with Annotations......Page 250
Using Filters in Your Application......Page 251
A Basic Filtering Example......Page 252
Summary......Page 256
Downloading the Data......Page 257
Geographic Names......Page 258
Second-Level Subdivisions......Page 260
Feature Codes......Page 261
Creating the Database Schema......Page 262
Loading the Data......Page 264
Creating a Java Object Model......Page 265
Creating the Admin1Code Class......Page 266
Creating the Admin2Code Class......Page 269
Creating the Feature Codes Class......Page 272
Creating the Place Class......Page 275
Configuring Hibernate......Page 279
Developing the HQL Query......Page 281
Running the Query......Page 282
Summary......Page 284
Managed Versioning and Optimistic Locking......Page 285
Maps......Page 286
Limitations of Hibernate......Page 287
Using a Direct Mapping......Page 288
Using a View......Page 289
Putting SQL into an Annotation or Mapping......Page 291
Invoking Stored Procedures......Page 293
Events......Page 294
An Example Event Listener......Page 297
Interceptors......Page 298
An Example Interceptor......Page 301
Overriding the Default Constructor......Page 306
Hibernate Search......Page 307
Summary......Page 308
The Eclipse Plug-In......Page 309
Installing the Plug-In......Page 310
The Boilerplate Project Configuration......Page 313
Using the Hibernate Console......Page 315
Creating a Hibernate Console Configuration......Page 316
Generating the Schema......Page 319
Browsing the Model......Page 320
Testing HQL Queries......Page 322
Query Parameters......Page 324
Creating a Mapping Diagram......Page 325
Generating a Configuration File......Page 326
The Reverse Engineering and Code Generation Tools......Page 327
How the Ant Tasks Work......Page 335
Reverse Engineering......Page 341
Templates......Page 345
Configuring the Classpath......Page 346
Summary......Page 347
Configuring Hibernate from a Spring Application......Page 349
Configuring Spring......Page 350
Using Hibernate in Your Spring Beans......Page 352
Declarative Transaction Management......Page 353
Managing the Session......Page 354
The Sample Configuration File......Page 355
Summary......Page 358
Package and DTD Changes......Page 359
New Features and Support for Old Ones......Page 360
Changes and Deprecated Features......Page 361
Changes to Tools and Libraries......Page 362
Summary......Page 363
¦Special Characters ¦A......Page 365
¦......Page 368
¦C......Page 369
¦D......Page 372
¦E......Page 374
¦F......Page 375
¦H......Page 377
¦I......Page 381
¦J......Page 382
¦......Page 384
¦M......Page 386
¦N......Page 388
¦O......Page 389
¦P......Page 391
¦......Page 393
¦S......Page 394
¦......Page 398
¦U......Page 399
¦Z......Page 401


📜 SIMILAR VOLUMES


Beginning Hibernate, 2nd Edition
✍ Jeff Linwood, Dave Minter 📂 Library 📅 2010 🌐 English

Beginning Hibernate, Second Edition is ideal if you’re experienced in Java with databases (the traditional, or “connected,” approach), but new to open-source, lightweight Hibernate—the de facto object-relational mapping and database-oriented application development framework. This book packs in info

Beginning Hibernate, 2nd Edition
✍ Jeff Linwood, Dave Minter 📂 Library 📅 2 🏛 Apress 🌐 English

Beginning Hibernate, Second Edition is ideal if you're experienced in Java with databases (the traditional, or connected, approach), but new to open-source, lightweight Hibernate - the de facto object-relational mapping and database-oriented application development framework. This book packs in inf

Beginning Hibernate: Third Edition
✍ Joseph B. Ottinger, Dave Minter, Jeff Linwood (auth.) 📂 Library 📅 2014 🏛 Apress 🌐 English

Beginning Hibernate, Third Edition is ideal if you’re experienced in Java with databases (the traditional, or “connected,” approach), but new to open-source, lightweight Hibernate, a leading object-relational mapping and database-oriented application development framework.

Java Persistence with Hibernate, 2nd Edi
✍ Christian Bauer, Gavin King, Gary Gregory 📂 Library 📅 2015 🏛 Manning 🌐 English

Java Persistence with Hibernate, 2nd Edition explores Hibernate by developing an application that ties together hundreds of individual examples. You'll immediately dig into the rich programming model of Hibernate, working through mappings, queries, fetching strategies, transactions, conversations, c

Beginning Hibernate, 3rd Edition
✍ Joseph Ottinger, Jeff Linwood, Dave Minter 📂 Library 📅 2014 🏛 Apress 🌐 English

Beginning Hibernate, 3rd Edition is ideal if you're experienced in Java with databases (the traditional, or "connected," approach), but new to open-source, lightweight Hibernate, a leading object-relational mapping and database-oriented application development framework. This book packs i

Hibernate Recipes, 2nd Edition: A Proble
✍ Joseph Ottinger, Srinivas Guruzu, Gary Mak 📂 Library 📅 2015 🏛 Apress 🌐 English

Hibernate Recipes, 2nd Edition contains a collection of code recipes and templates for learning and building Hibernate solutions for you and your clients, including how to work with the Spring Framework and the JPA. This book is your pragmatic day-to-day reference and guide for doing all things invo