Why I Wrote This Book
I believe there are two levels of learning, just like a two-course meal. The first course is a simple and easy one, but creates expectations for an appetizing second course. It not only satisfies our hunger to some extent but also gives us a taste of whats to come in the second course.
Many books offer two-course meals in one go. This is great for many of us. However, in my opinion, we may not have adequate time or space or drive to learn the depths of the technology straightaway. Moreover, as always, we get confused with equally good offerings from different vendors (restaurants, so to speak)! Not to mention, over time, the menus keep changing too!
I believe in serving an appealing, appetizing, and light first-course meal that convinces guests to stay on for the second course. It is a challenging and sometimes daunting task to serve this type of meal!
Working with my seven-year-old son, Joshua, on his homework helped me understand how important (and hard) it is to teach basics and fundamentals in a simple and easy manner. He grasped even the hardest subjects quickly when I got down to his level by explaining them with examples and easy-to-understand language.
I have known many programmers and developers who sometimes stumble on the basics. They often feel shy about asking colleagues for help. I have also met a few who were pushed into projects with new technologies without training or guidance, but were expected to produce results overnight.
There are people who are genuinely interested in learning the technology but may be put off by the big texts or manuals. These people are enthusiastic and want to hit the ground running, but they dont have the time or patience to read and digest volumes of data! They have time only to read a simple book, learn the technology, and jump straight into practice. Once they get the hang of it, their grey matter will ask for more andmore.
When I want to learn something new, I start experimenting with basic code, move an inch further, burn a bit of code, and so on. Once I get a feel for the framework, I turn to other avenues to quench my thirst. At that point, I seek out the advanced, in-depth manuals and specs, and of course, the big books.
My motive behind the Just series of books is to deliver simple yet powerful page-turners. I aim to deliver straight-to-the-point, no-nonsense, and example-driven books on my favorite technologies. And, of course, Id like them to be easy reads. These books should give you enough knowledge and confidence to start working on real-world projects.
How This Book Is Organized
The book is presented in eight simple chapters. Each chapter will deal with one or two specific themes. All the chapters are presented with code snippets to illustrate the technology in detail. You should download and work closely with the accompanying source code.
The organization and goals of the chapters are as follows:
This chapter sets the scene for using Hibernate. We define the problem domain, work out a solution using JDBC, and reengineer the problem employing Hibernate. Well get a taste of the framework from a very high level.You learned about the problem Hibernate is trying to solve in the first chapter. Here, in the second chapter, we dive into the framework to explore its moving parts and their work in action. We walk through Hibernates fundamental pieces in detail.In this chapter, we will focus on creating Hibernate applications using annotations. This chapter covers the basics of annotations, getting you ready to jump into the Hibernate annotations that well be using in the rest of the book.Persisting collections is a challenging task for developers. This chapter is dedicated to helping you understand the mechanics of persistence and how to work with collections.Youll learn about Hibernates support for associations and relationships in this chapter. It covers the fundamental associations, such as one-to-many and many-to-many, with relevant examples. I tried to keep this chapter as slim as possible, but given the extent of the relevant material, I slightly missed my target! This is an important chapter, and getting associations right is half your job done!This chapter deals with a few advanced concepts such as caching, inheritance strategies, types, and filters. You should run through this chapter to gain a better understanding of the framework and what it provides in relation to inheritance, caching, and other features.Similar to SQL, Hibernate exposes its own query language to work with objects. This chapter introduces you to HQL and walks you through the API with examples.This chapter looks at a standard in the Java Persistence world, JPA, from Hibernates view. We discuss Hibernates support in implementing JPA standards and how we can use them in our applications.
Conventions Used in This Book
The following typographical conventions are used in this book:
Italic Indicates new terms, URLs, email addresses, filenames, and file extensions. Constant width
Used for program listings, as well as within paragraphs to refer to program elements such as variable or function names, databases, data types, environment variables, statements, and keywords. Constant width bold