Part 2. Mapping strategies


This part is all about actual ORM, from classes and properties to tables and columns. Chapter 4 starts with regular class and property mappings and explains how you can map fine-grained Java domain models. Next, in chapter 5, you’ll see how to map basic properties and embeddable components, and how to control mapping between Java and SQL types. In chapter 6, you’ll map inheritance hierarchies of entities to the database using four basic inheritance-mapping strategies; you’ll also map polymorphic associations. Chapter 7 is all about mapping collections and entity associations: you map persistent collections, collections of basic and embeddable types, and simple many-to-one and one-to-many entity associations. Chapter 8 dives deeper with advanced entity association mappings like mapping one-to-one entity associations, one-to-many mapping options, and many-to-many and ternary entity relationships. Finally, you’ll find chapter 9 most interesting if you need to introduce Hibernate in an existing application, or if you have to work with legacy database schemas and handwritten SQL. We’ll also talk about customized SQL DDL for schema generation in this chapter.