Java Persistence with JPA and Hibernate
4h 9mIntermediate2024-09-12
Authors

Buddhini Samarakkody
Java Engineer, Author, Instructor
Course details
Explore the mismatch between object-oriented code and relational tables to understand the need for object-relational mapping (ORM). In this course, instructor Buddhini Samarakkody covers the basics of JPA—shorthand for the Jakarta Persistence API—and shows you how to implement it in the popular ORM framework, Hibernate. Learn how to define an entity, map fields to columns, specify primary and composite keys, utilize annotations, map different types of entity relationships, execute basic CRUD operations, and more. Along the way, Buddhini offers insights on how to work with different types of queries and use a wide variety of constructs to perform key tasks. By the end of this course, you’ll also be equipped with some of the best practices for applying the repository pattern to streamline and optimize your code.
Skills covered
JPAAPIsDatabase DevelopmentOracleDatabase ManagementProgramming LanguagesSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Learning about Java Persistence with Hibernate
- 02 - What you should know
1. The Object-Relational Incongruence
- 03 - Object-relational impedance mismatch
- 04 - Problems related to impedance mismatch
- 05 - What is ORM
- 06 - What is Jakarta Persistence
- 07 - Hibernate as a JPA provider
2. Setting the Ground for Java-Hibernate Development
- 08 - Development environment
- 09 - Database
- 10 - Dependencies
3. The Crux of ORM with JPA and Hibernate
- 11 - Entities and the persistence context
- 12 - EntityManager interface
- 13 - Bootstrapping JPA and Hibernate - Creating the configuration
- 14 - Bootstrapping JPA and Hibernate - Creating the EntityManager
- 15 - Challenge - Art Class Management app, part 1
- 16 - Solution - Art Class Management app, part 1
4. Getting Started with JPA and Hibernate
- 17 - Defining an entity
- 18 - Mapping entity fields to table columns
- 19 - Specifying the primary key
- 20 - Creating a new entity instance in the context
- 21 - Challenge - Art Class Management app, part 2
- 22 - Solution - Art Class Management app, part 2
5. Getting a Bit More Advanced with Entities
- 23 - Finding and updating an existing entity instance
- 24 - Attaching and detaching an entity instance
- 25 - Removing an entity instance
- 26 - Using the getReference() and refresh() methods
- 27 - Using composite keys on an entity
- 28 - Challenge - Art Class Management app, part 3
- 29 - Solution - Art Class Management app, part 3
6. Working with Entity Relationships
- 30 - One-to-one relationships
- 31 - @OneToMany and @ManyToOne annotations in a relationship
- 32 - Many-to-many relationships
- 33 - Inheritance
- 34 - More inheritance strategies
- 35 - Composition relationship
- 36 - Challenge - Art Class Management app, part 4
- 37 - Solution - Art Class Management app, part 4
7. Working with Queries
- 38 - JPQL queries
- 39 - Joins with JPQL
- 40 - Named queries
- 41 - Aggregate functions
- 42 - ORDER BY, GROUP BY, and HAVING
- 43 - Native queries
- 44 - Criteria queries
- 45 - Challenge - Art Class Management app, part 5
- 46 - Solution - Art Class Management app, part 5
8. Taking Your Code to the Next Level
- 47 - The repository pattern
- 48 - Implementing the repository pattern
- 49 - Challenge - Art Class Management app, part 6
- 50 - Solution - Art Class Management app, part 6
Conclusion
- 51 - Next steps