liveBook · Manning

What you will learn in Java Persistence with Spring Data and Hibernate epub

by Catalin Tudose

Chapter by chapter

Chapter 1: Understanding object/relational persistence

1.1 What is persistence? · 1.1.1 Relational databases · 1.1.2 Understanding SQL · 1.1.3 Using SQL in Java · 1.2 The paradigm mismatch · 1.2.1 The problem of granularity · 1.2.2 The problem of inheritance · 1.2.3 The problem of identity · 1.2.4 The problem of associations · 1.2.5 The problem of data navigation · 1.3 ORM, JPA, Hibernate, and Spring Data · 1.4 Summary

What you learn in chapter 1 →

Chapter 2: Starting a project

2.1 Introducing Hibernate · 2.2 Introducing Spring Data · 2.3 “Hello World” with JPA · 2.3.1 Configuring a persistence unit · 2.3.2 Writing a persistent class · 2.3.3 Storing and loading messages · 2.4 Native Hibernate configuration · 2.5 Switching between JPA and Hibernate · 2.6 “Hello World” with Spring Data JPA · 2.7 Comparing the approaches of persisting entities · 2.8 Summary

What you learn in chapter 2 →

Chapter 3: Domain models and metadata

3.1 The example CaveatEmptor application · 3.1.1 A layered architecture · 3.1.2 Analyzing the business domain · 3.1.3 The CaveatEmptor domain model · 3.2 Implementing the domain model · 3.2.1 Addressing leakage of concerns · 3.2.2 Transparent and automated persistence · 3.2.3 Writing persistence-capable classes · 3.2.4 Implementing POJO associations · 3.3 Domain model metadata · 3.3.1 Annotation-based metadata · 3.3.2 Applying constraints to Java objects · 3.3.3 Externalizing metadata with XML files · 3.3.4 Accessing metadata at runtime · 3.4 Summary

What you learn in chapter 3 →

Chapter 4: Working with Spring Data JPA

4.1 Introducing Spring Data JPA · 4.2 Starting a new Spring Data JPA project · 4.3 First steps for configuring a Spring Data JPA project · 4.4 Defining query methods with Spring Data JPA · 4.5 Limiting query results, sorting, and paging · 4.6 Streaming results · 4.7 The @Query annotation · 4.8 Projections · 4.9 Modifying queries · 4.10 Query by Example · 4.11 Summary

What you learn in chapter 4 →

Chapter 5: Mapping persistent classes

5.1 Understanding entities and value types · 5.1.1 Fine-grained domain models · 5.1.2 Defining application concepts · 5.1.3 Distinguishing entities and value types · 5.2 Mapping entities with identity · 5.2.1 Understanding Java identity and equality · 5.2.2 A first entity class and mapping · 5.2.3 Selecting a primary key · 5.2.4 Configuring key generators · 5.2.5 Identifier generator strategies · 5.3 Entity-mapping options · 5.3.1 Controlling names · 5.3.2 Dynamic SQL generation · 5.3.3 Making an entity immutable · 5.3.4 Mapping an entity to a subselect · 5.4 Summary

What you learn in chapter 5 →

Chapter 6: Mapping value types

6.1 Mapping basic properties · 6.1.1 Overriding basic property defaults · 6.1.2 Customizing property access · 6.1.3 Using derived properties · 6.1.4 Transforming column values · 6.1.5 Generated and default property values · 6.1.6 The @Temporal annotation · 6.1.7 Mapping enumerations · 6.2 Mapping embeddable components · 6.2.1 The database schema · 6.2.2 Making classes embeddable · 6.2.3 Overriding embedded attributes · 6.2.4 Mapping nested embedded components · 6.3 Mapping Java and SQL types with converters · 6.3.1 Built-in types · 6.3.2 Creating custom JPA converters · 6.3.3 Extending Hibernate with UserTypes · 6.4 Summary

What you learn in chapter 6 →

Chapter 7: Mapping inheritance

7.1 Table per concrete class with implicit polymorphism · 7.2 Table per concrete class with unions · 7.3 Table per class hierarchy · 7.4 Table per subclass with joins · 7.5 Mixing inheritance strategies · 7.6 Inheritance of embeddable classes · 7.7 Choosing a strategy · 7.8 Polymorphic associations · 7.8.1 Polymorphic many-to-one associations · 7.8.2 Polymorphic collections · 7.9 Summary

What you learn in chapter 7 →

Chapter 8: Mapping collections and entity associations

8.1 Sets, bags, lists, and maps of value types · 8.1.1 The database schema · 8.1.2 Creating and mapping a collection property · 8.1.3 Selecting a collection interface · 8.1.4 Mapping a set · 8.1.5 Mapping an identifier bag · 8.1.6 Mapping a list · 8.1.7 Mapping a map · 8.1.8 Sorted and ordered collections · 8.2 Collections of components · 8.2.1 Equality of component instances · 8.2.2 Set of components · 8.2.3 Bag of components · 8.2.4 Map of component values · 8.2.5 Components as map keys · 8.2.6 Collection in an embeddable component · 8.3 Mapping entity associations · 8.3.1 The simplest possible association · 8.3.2 Making it bidirectional · 8.3.3 Cascading state · 8.4 Summary

What you learn in chapter 8 →

Chapter 9: Advanced entity association mappings

9.1 One-to-one associations · 9.1.1 Sharing a primary key · 9.1.2 The foreign primary key generator · 9.1.3 Using a foreign key join column · 9.1.4 Using a join table · 9.2 One-to-many associations · 9.2.1 Considering one-to-many bags · 9.2.2 Unidirectional and bidirectional list mappings · 9.2.3 Optional one-to-many with a join table · 9.2.4 One-to-many association in an embeddable class · 9.3 Many-to-many and ternary associations · 9.3.1 Unidirectional and bidirectional many-to-many associations · 9.3.2 Many-to-many with an intermediate entity · 9.3.3 Ternary associations with components · 9.4 Entity associations with maps · 9.4.1 One-to-many with a property key · 9.4.2 Key/value ternary relationship · 9.5 Summary

What you learn in chapter 9 →

Chapter 10: Managing data

10.1 The persistence lifecycle · 10.1.1 Entity instance states · 10.1.2 The persistence context · 10.2 The EntityManager interface · 10.2.1 The canonical unit of work · 10.2.2 Making data persistent · 10.2.3 Retrieving and modifying persistent data · 10.2.4 Getting a reference · 10.2.5 Making data transient · 10.2.6 Refreshing data · 10.2.7 Replicating data · 10.2.8 Caching in the persistence context · 10.2.9 Flushing the persistence context · 10.3 Working with detached state · 10.3.1 The identity of detached instances · 10.3.2 Implementing equality methods · 10.3.3 Detaching entity instances · 10.3.4 Merging entity instances · 10.4 Summary

What you learn in chapter 10 →

Chapter 11: Transactions and concurrency

11.1 Transaction essentials · 11.1.1 ACID attributes · 11.1.2 Database and system transactions · 11.2 Controlling concurrent access · 11.2.1 Understanding database-level concurrency · 11.2.2 Optimistic concurrency control · 11.2.3 Explicit pessimistic locking · 11.2.4 Avoiding deadlocks · 11.3 Non-transactional data access · 11.3.1 Reading data in auto-commit mode · 11.3.2 Queuing modifications · 11.4 Managing transactions with Spring and Spring Data · 11.4.1 Transaction propagation · 11.4.2 Transaction rollback · 11.4.3 Transaction properties · 11.4.4 Programmatic transaction definition · 11.4.5 Transactional development with Spring and Spring Data · 11.5 Summary

What you learn in chapter 11 →

Chapter 12: Fetch plans, strategies, and profiles

12.1 Lazy and eager loading · 12.1.1 Understanding entity proxies · 12.1.2 Lazy persistent collections · 12.1.3 Eager loading of associations and collections · 12.2 Selecting a fetch strategy · 12.2.1 The n+1 selects problem · 12.2.2 The Cartesian product problem · 12.2.3 Prefetching data in batches · 12.2.4 Prefetching collections with subselects · 12.2.5 Eager fetching with multiple SELECTs · 12.2.6 Dynamic eager fetching · 12.3 Using fetch profiles · 12.3.1 Declaring Hibernate fetch profiles · 12.3.2 Working with entity graphs · 12.4 Summary

What you learn in chapter 12 →

Chapter 13: Filtering data

13.1 Cascading state transitions · 13.1.1 Available cascading options · 13.1.2 Transitive detachment and merging · 13.1.3 Cascading refresh · 13.1.4 Cascading replication · 13.2 Listening to and intercepting events · 13.2.1 JPA event listeners and callbacks · 13.2.2 Implementing Hibernate interceptors · 13.2.3 The core event system · 13.3 Auditing and versioning with Hibernate Envers · 13.3.1 Enabling audit logging · 13.3.2 Creating an audit trail · 13.3.3 Finding revisions · 13.3.4 Accessing historical data · 13.4 Dynamic data filters · 13.4.1 Defining dynamic filters · 13.4.2 Applying a dynamic filter · 13.4.3 Enabling a dynamic filter · 13.4.4 Filtering collection access · 13.5 Summary

What you learn in chapter 13 →

Chapter 14: Integrating JPA and Hibernate with Spring

14.1 Spring Framework and dependency injection · 14.2 JPA application using Spring and the DAO pattern · 14.3 Generifying a JPA application that uses Spring and DAO · 14.4 Hibernate application using Spring and the DAO pattern · 14.5 Generifying a Hibernate application that uses Spring and DAO · 14.6 Summary

What you learn in chapter 14 →

Chapter 15: Working with Spring Data JDBC

15.1 Creating a Spring Data JDBC project · 15.2 Working with queries in Spring Data JDBC · 15.2.1 Defining query methods with Spring Data JDBC · 15.2.2 Limiting query results, sorting, and paging · 15.2.3 Streaming results · 15.2.4 The @Query annotation · 15.2.5 Modifying queries · 15.3 Modeling relationships with Spring Data JDBC · 15.3.1 Modeling a one-to-one relationship with Spring Data JDBC · 15.3.2 Modeling embedded entities with Spring Data JDBC · 15.3.3 Modeling a one-to-many relationship with Spring Data JDBC · 15.3.4 Modeling a many-to-many relationship with Spring Data JDBC · 15.4 Summary

What you learn in chapter 15 →

Chapter 16: Working with Spring Data REST

16.1 Introducing REST applications · 16.2 Creating a Spring Data REST application · 16.3 Using ETags for conditional requests · 16.4 Limiting access to repositories, methods, and fields · 16.5 Working with REST events · 16.5.1 Writing an AnnotatedHandler · 16.5.2 Writing an ApplicationListener · 16.6 Using projections and excerpts · 16.7 Summary

What you learn in chapter 16 →

Chapter 17: Working with Spring Data MongoDB

17.1 Introducing MongoDB · 17.2 Introducing Spring Data MongoDB · 17.3 Using MongoRepository to access a database · 17.3.1 Defining query methods with Spring Data MongoDB · 17.3.2 Limiting query results, sorting, and paging · 17.3.3 Streaming results · 17.3.4 The @Query annotation · 17.4 Query by Example · 17.5 Referencing other MongoDB documents · 17.6 Using MongoTemplate to access a database · 17.6.1 Configuring access to the database through MongoTemplate · 17.6.2 Executing CRUD operations using MongoTemplate · 17.7 Summary

What you learn in chapter 17 →

Chapter 18: Working with Hibernate OGM

18.1 Introducing Hibernate OGM · 18.2 Building a simple MongoDB Hibernate OGM application · 18.2.1 Configuring the Hibernate OGM application · 18.2.2 Creating the entities · 18.2.3 Using the application with MongoDB · 18.3 Switching to the Neo4j NoSQL database · 18.4 Summary

What you learn in chapter 18 →

Chapter 19: Querying JPA with Querydsl

19.1 Introducing Querydsl · 19.2 Creating a Querydsl application · 19.2.1 Configuring the Querydsl application · 19.2.2 Creating the entities · 19.2.3 Creating the test data to query · 19.3 Querying a database with Querydsl · 19.3.1 Filtering data · 19.3.2 Ordering data · 19.3.3 Grouping data and working with aggregates · 19.3.4 Working with subqueries and joins · 19.3.5 Updating entities · 19.3.6 Deleting entities · 19.4 Summary

What you learn in chapter 19 →

Chapter 20: Testing Java persistence applications

20.1 Introducing the test pyramid · 20.2 Creating the persistence application to test · 20.3 Using the Spring TestContext Framework · 20.4 The @DirtiesContext annotation · 20.5 @Transactional execution · 20.6 The @BeforeTransaction and @AfterTransaction annotations · 20.7 Working with Spring profiles · 20.8 Working with test execution listeners · 20.9 Summary

What you learn in chapter 20 →

Concepts explained in this book

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.