Harnessing Hibernate is an ideal introduction to the popular framework that lets Java developers work with information from a relational database easily and efficiently. Databases are a very different world than Java objects, and they often involve people with different skills and specializations. With Hibernate, bridging these two worlds is significantly easier, and with this book, you can get up to speed with Hibernate quickly.
Rather than present you with another reference, Harnessing Hibernate lets you explore the system, from download and configuration through a series of projects that demonstrate how to accomplish a variety of practical goals. The new edition of this concise guide walks you through Hibernate's primary features, which include mapping from Java classes to database tables, and from Java data types to SQL data types. You will also learn about Hibernate's data query and retrieval facilities, and much more.
By reading and following along with the examples, you can get your own Hibernate environment set up quickly and start using it for real-world tasks right away. Harnessing Hibernate teaches you how to:
Perform Object/Relational mapping
Work with persistent data from Java code
Work with groups and relationships between objects
Extend Hibernate's rich type support for your own needs
Simplify query creation using criteria and examples
Use the Hibernate Query Language (HQL) and understand how it differs from SQL
Use Hibernate in conjunction with Spring
Use Hibernate in conjunction with other packages, such as the Stripes web framework and the Eclipse IDE
Once you're past the first few chapters, you can jump to topics that you find particularly interesting or relevant. All background material and explanations of how Hibernate works and why is in the service of a focused task. Source code can be downloaded from the book's website.
If using SQL is an uncomfortable chore, Harnessing Hibernate offers you an effective and trouble-free method for working with the information you store in your applications.
Hibernate in a Hurry
Chapter 1 Installation and Setup
Getting an Ant Distribution
Check Your Java Version
Getting the Maven Tasks for Ant
Installing the Maven Tasks for Ant
Using the HSQLDB Database Engine
Using Hibernate Core
Setting Up a Project Hierarchy
Chapter 2 Introduction to Mapping
Writing a Mapping Document
Generating Some Class
Cooking Up a Schema
Chapter 3 Harnessing Hibernate
Creating Persistent Objects
Finding Persistent Objects
Better Ways to Build Queries
Chapter 4 Collections and Associations
Using Bidirectional Associations
Working with Simpler Collections
Chapter 5 Richer Associations
Eager and Lazy Associations
Augmenting Associations in Collections
Chapter 6 Custom Value Types
Defining a User Type
Defining a Persistent Enumerated Type
Using a Custom Type Mapping
Working with Persistent Enumerations
Building a Composite User Type
Chapter 7 The Annotations Alternative
Annotating Model Objects
An Alternate Approach
Chapter 8 Criteria Queries
Using Simple Criteria
Projection and Aggregation with Criteria
Applying Criteria to Associations
Querying by Example
Property-Oriented Criteria Factories
Chapter 9 A Look at HQL
Writing HQL Queries
Selecting Properties and Pieces
Working with Aggregate Values
Writing Native SQL Queries
Playing Nice with Others
Chapter 10 Connecting Hibernate to MySQL
Setting Up a MySQL Database
Connecting to MySQL
Trying It Out
Looking at the Data
Chapter 11 Hibernate and Eclipse: Really Using the Hibernate Tools
Installing the Hibernate Tools in Eclipse
Creating a Hibernate Console Configuration
More Editing Support
The Hibernate Console Perspective
Chapter 12 Maven in More Depth
What Is Maven?
Building, Testing, and Running a Project
Generating IDE Project Files using Maven
Generating Reports with Maven
A Maven Project Object Model
The Maven Build Lifecycle
Using the Maven Hibernate3 Plug-in
Becoming a Maven Maven
Chapter 13 Put a Spring in your Step: Hibernate with Spring
What Is Spring?
Writing a Data Access Object
Creating an Application Context
Putting It All Together
Chapter 14 The Finishing Touch: Stripes with Spring and Hibernate
Earn Your Stripes
Create the Web Application
Dealing with Associations
Appendix Hibernate Types
Custom Value Types
“Any” Type Mappings
Appendix The Criteria API
The Criterion Factory
The Projection Factory
The Order Factory
The Property Factory
Appendix Hibernate SQL Dialects
Getting Fluent in the Local SQL
Appendix Spring Transaction Support
Using the Spring Framework’s Transactional Annotation
James Elliott is a senior software engineer at Berbee, with fifteen years' professional experience as a systems developer. He started designing with objects well before work environments made it convenient, and has a passion for building high-quality Java tools and frameworks to simplify the tasks of other developers.
Tim is a professional singer/programmer living and working in the Chicago area. He prefers Emacs to vi. Tim discovered programming on a TRS-80, and went on to study (and subsequently forget) Electrical Engineering at UVA. In his free time Tim likes to sleep, study music, build toys with microcontrollers, and participate in open source projects. Tim is active in the Jakarta Commons.
Ryan Fowler is a software engineer at Berbee in Madison, WI. He programmed Basic on Apple II machines for a while in elementary school at St. Stephen School in Grand Rapids, MI. He returned to coding in the computer science department at Alma College in Alma, MI while earning his bachelor's degree. Ryan skis, sails and rounds life out with some guitar playing when there's no snow or wind.
The animal on the cover of Harnessing Hibernate is a hedgehog, a small mammal in the family Erinaceinae. There are 16 hedgehog species in 5 genera, found throughout parts of Europe, Asia, Africa, and New Zealand. Some of these species are: the four-toed hedgehog (south-Saharan Africa); the long-eared hedgehog (Central Asia); the desert hedgehog (Africa and the Middle East); and the bare-bellied hedgehog (India). The different species vary in size, measuring 5 to 12 inches long and weighing 15 to 40 ounces. The most common domesticated hedgehog, known as the four-toed or African pygmy hedgehog, is smaller than its European cousins and has become a popular pet in many countries. The name hedgehog first came into use in the mid-15th century--"hedge" because it roots through undergrowth, and "hog" because of its pig-like snout. Hedgehogs are also known as urchins, hedgepigs, and furze-pigs.
The hedgehog's most distinctive feature is its spines, which grow everywhere on its body except its face, legs, and belly. When threatened, it rolls into a tight ball so that all of its spines point outward, presenting a barbed surface to predators. These spines are stiff, hollow hairs made of keratin and are very strong. Unlike a porcupine's quills, they do not fall out, except when a hedgehog sheds its baby spines during a process known as "quilling."
Hedgehogs eat small invertebrates such as frogs, slugs, and earthworms. Some hedgehogs have immunity to toxins and can eat bees, wasps, and venomous snakes. Being nocturnal, they sleep for most of the day in grass or under rocks or in holes in the ground. Although all hedgehogs can hibernate, not all do-hibernation depends on factors such as location, temperature, and abundance of food. In England, Bonfire Night celebrations on November 5th pose a particular risk to hedgehogs, who often sleep in the wood piles used for bonfires. Wildlife protection groups now warn the public to inspect their wood piles before lighting fires in order to protect hibernating hedgehogs.
The cover image is from J. G. Wood's Animate Creation. The cover font is Adobe ITC Garamond. The text font is Linotype Birka; the heading font is Adobe Myriad Condensed; and the code font is LucasFont's TheSansMonoCondensed.
I read 2 years ago, now I am reading it again. I like the way of continuously building a project from chapter by chapter. I also like the way of writing so that it is so easy to understand and grape the concept. Except for Hibernate, I like the Ant, Maven and HSQLDB. Great books!
Bottom Line Yes, I would recommend this to a friend
I read official Hibernate manuals. I read online tutorials. I got this book whilst in middle of attending Hibernate course. This book is way easier to understand than the course, and will get you to grips with installing and setting up Hibernate. If you have never Hibernated before, read this book. It's smarter than the average Hibernate course.
Bottom Line Yes, I would recommend this to a friend