O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Master Hibernate and JPA with Spring Boot in 100 Steps

Video Description

Learn the fundamentals of the Java Persistence API (JPA) and the Hibernate framework using Spring and Spring Boot

About This Video

  • We will help you to install Eclipse and get up and running with all the frameworks, Maven and embedded Tomcat.
  • This 6-hour course is very good if you have some knowledge of Java and want to refresh the core java topics.

In Detail

The Java Persistence API provides Java developers with an API for mapping Java objects to relational data. In this course, you will learn about the JPA API, JPQL (Java Persistence query language), the Java persistence criteria API, and how you can perform ORM (Object Relational Mapping) with JPA. Hibernate is the most popular implementation of JPA. It was the most popular ORM framework option before JPA emerged and it provides additional features on top of JPA. We will use Hibernate as the JPA implementation in this course.

Table of Contents

  1. Chapter 1 : Introduction
    1. Master Hibernate and JPA with Spring Boot - Preview 00:03:00
    2. Master Hibernate and JPA with Spring Boot - Course Overview 00:03:04
    3. Master Hibernate and JPA with Spring Boot - Git Repository 00:02:30
    4. Master Hibernate and JPA with Spring Boot - Installing Basic Tools 00:01:33
    5. Quick introduction to JPA 00:07:32
  2. Chapter 2 : Introduction to Spring Boot in 10 Steps
    1. Introduction to Spring Boot in 10 Steps 00:01:33
    2. Step 1: Introduction to Spring Boot - Goals and Important Features 00:06:11
    3. Step 2: Developing Spring Applications before Spring Boot 00:03:46
    4. Step 3: Using Spring Initializr to create a Spring Boot Application 00:04:48
    5. Step 4: Creating a Simple REST Controller 00:05:03
    6. Step 5: What is Spring Boot Auto Configuration? 00:09:07
    7. Step 6: Spring Boot vs Spring vs Spring MVC 00:05:55
    8. Step 7: Spring Boot Starter Projects - Starter Web and Starter JPA 00:07:39
    9. Step 8: Overview of different Spring Boot Starter Projects 00:04:01
    10. Step 9: Spring Boot Actuator 00:08:38
    11. Step 10: Spring Boot Developer Tools 00:04:12
  3. Chapter 3 : Journey From Spring JDBC to JPA
    1. Introduction to Journey from JDBC To JPA 00:01:30
    2. Step 01 - Setting up a project with JDBC, JPA, H2 and Web Dependencies 00:05:32
    3. Step 02 - Launching up H2 Console 00:05:05
    4. Step 03 - Creating a Database Table in H2 00:03:54
    5. Step 04 - Populate data into Person Table 00:05:21
    6. Step 05 - Implement findAll persons Spring JDBC Query Method 00:06:15
    7. Step 06 - Execute the findAll method using CommandLineRunner 00:05:45
    8. Step 07 - A Quick Review - JDBC vs Spring JDBC 00:02:41
    9. Step 08 - Whats in the background? Understanding Spring Boot Autoconfiguration 00:05:06
    10. Step 09 - Implementing findById Spring JDBC Query Method 00:03:48
    11. Step 10 - Implementing deleteById Spring JDBC Update Method 00:03:08
    12. Step 11 - Implementing insert and update Spring JDBC Update Methods 00:08:39
    13. Step 12 - Creating a custom Spring JDBC RowMapper 00:04:58
    14. Step 13 - Quick introduction to JPA 00:05:54
    15. Step 14 - Defining Person Entity 00:04:03
    16. Step 15 - Implementing findById JPA Repository Method 00:08:06
    17. Step 16 - Implementing insert and update JPA Repository Methods 00:03:51
    18. Step 17 - Implementing deleteById JPA Repository Method 00:02:10
    19. Step 18 - Implementing findAll using JPQL Named Query 00:04:03
  4. Chapter 4 : Introduction to JUnit in 5 Steps
    1. Introduction to JUnit in 5 Steps 00:01:08
    2. Step 1: What is JUnit and Unit Testing? 00:03:55
    3. Step 2: First JUnit Project and Green Bar 00:04:44
    4. Step 3: First Code and First Unit Test 00:05:07
    5. Step 4: Other assert methods 00:03:46
    6. Step 5: Important annotations 00:05:08
  5. Chapter 5 : JPA and Hibernate in Depth
    1. Introduction to JPA and Hibernate in Depth 00:01:43
    2. Step 01 - Create a JPA Project with H2 and Spring Boot 00:04:43
    3. Step 02 - Create JPA Entity Course 00:04:04
    4. Step 03 - Create findById using JPA Entity Manager 00:08:24
    5. Step 04 - Configuring application properties to enable H2 console and logging 00:07:08
    6. Step 05 - Writing Unit Test for findById method 00:10:46
    7. Step 06 - Writing a deleteByID method to delete an Entity 00:05:41
    8. Step 07 - Writing Unit Test for deleteById method 00:04:33
    9. Step 08 - Writing a save method to update and insert an Entity 00:03:23
    10. Step 09 - Writing Unit Test for save method 00:05:51
    11. Step 10 - Quick Review and Debugging Tips 00:07:16
    12. Step 11 - Playing with Entity Manager 00:07:16
    13. Step 12 - Entity Manager Methods - clear and detach 00:05:32
    14. Step 13 - Entity Manager Methods – refresh 00:06:31
    15. Step 14 - A Quick Review of Entity Manager 00:02:10
    16. Step 15 - JPQL – Basics 00:07:57
    17. Step 16 - JPA and Hibernate Annotations - @Table 00:04:35
    18. Step 17 - JPA and Hibernate Annotations - @Column 00:05:48
    19. Step 18 - JPA and Hibernate Annotations - @UpdateTimestamp & @CreationTimestamp 00:07:08
    20. Step 19 - JPA and Hibernate Annotations - @NamedQuery and @NamedQueries 00:04:21
    21. Step 20 - Native Queries – Basics 00:08:15
  6. Chapter 6 : Establishing Relationships with JPA and Hibernate – OneToOne
    1. Step 21 - Entities and Relationships - An overview 00:06:21
    2. Step 22 - Defining Entities - Student, Passport and Review 00:09:30
    3. Step 23 - Introduction to One to One Relationship 00:07:22
    4. Step 24 - OneToOne Mapping - Insert Student with Passport 00:08:46
    5. Step 25 - OneToOne Mapping - Retrieving Student with Passport and Eager Fetch 00:04:33
    6. Step 26 - OneToOne Mapping - Lazy Fetch 00:04:50
    7. Step 27 - Transaction, Entity Manager and Persistence Context 00:10:12
    8. Step 28 - OneToOne Mapping - Bidirectional Relationship - Part 1 00:06:35
    9. Step 29 - OneToOne Mapping - Bidirectional Relationship - Part 2 00:03:52
  7. Chapter 7 : Let's review with a few FAQs about Hibernate and JPA
    1. FAQ 1 - When does Hibernate send updates to the database? 00:06:13
    2. FAQ 2 - When do we need @Transactional in a Unit Test? 00:03:10
    3. FAQ 3 – Do read only methods need a transaction? 00:04:58
    4. FAQ 4 - Why do we use @DirtiesContext in an Unit Test? 00:02:46
  8. Chapter 8 : Establishing Relationships with JPA and Hibernate - OneToMany and ManyToMany
    1. Step 30 - ManyToOne Mapping - Designing the database 00:04:34
    2. Step 30 - Part 2 - ManyToOne Mapping - Implementing the Mapping 00:06:52
    3. Step 31 - ManyToOne Mapping - Retrieving and inserting Reviews for Course 00:08:09
    4. Step 32 - ManyToOne Mapping - Generalizing Insert Reviews 00:06:09
    5. Step 33 - ManyToOne Mapping - Wrapping up 00:09:28
    6. Step 34 - ManyToMany Mapping - Table Design 00:02:59
    7. Step 35 - ManyToMany Mapping - Adding Annotations on Entities 00:04:44
    8. Step 36 - ManyToMany Mapping - Fixing two join tables problem 00:03:27
    9. Step 37 - ManyToMany Mapping - Customizing the Join Table 00:05:02
    10. Step 38 - ManyToMany Mapping - Insert Data and Write Join Query 00:04:41
    11. Step 39 - ManyToMany Mapping - Retrieve Data using JPA Relationships 00:07:11
    12. Step 40 - ManyToMany Mapping - Insert Student and Course 00:08:38
    13. Step 41 - Relationships between JPA Entities - A summary 00:03:58
  9. Chapter 9 : Inheritance Hierarchies with JPA and Hibernate
    1. Step 42 - Introduction to Inheritance Hierarchies and Mappings 00:02:34
    2. Step 43 - JPA Inheritance Hierarchies and Mappings - Setting up entities 00:04:13
    3. Step 44 - JPA Inheritance Hierarchies and Mappings - Setting up a Repository 00:05:12
    4. Step 45 - JPA Inheritance Hierarchies and Mappings - Single Table 00:05:31
    5. Step 46 - JPA Inheritance Hierarchies and Mappings - Table Per Class 00:03:35
    6. Step 47 - JPA Inheritance Hierarchies and Mappings – Joined 00:03:53
    7. Step 48 - JPA Inheritance Hierarchies and Mappings - Mapped Super Class 00:05:14
    8. Step 49 - JPA Inheritance Hierarchies and Mappings - How to Choose? 00:04:37
  10. Chapter 10 : Queries with Entities using JPQL
    1. Step 50 - JPQL - Courses without Students 00:05:54
    2. Step 51 - JPQL - Courses with at least 2 Students and order by 00:03:57
    3. Step 52 - JPQL - Courses like 100 Steps 00:04:22
    4. Step 53 - JPQL - Using Joins 00:10:21
  11. Chapter 11 : Queries using Java API - Criteria Queries
    1. Step 54 - Criteria Query - Retrieving all courses 00:09:03
    2. Step 55 - Criteria Query - Courses like 100 Steps 00:03:27
    3. Step 56 - Criteria Query - Courses without Students 00:02:16
    4. Step 57 - Criteria Query - Using Joins 00:03:48
  12. Chapter 12 : Transaction Management
    1. Step 58 - Introduction to Transaction Management 00:04:43
    2. Step 59 - Transaction Management - ACID Properties 00:06:04
    3. Step 60 - Understanding Dirty, Phanthom and Non Repeatable Reads 00:09:25
    4. Step 61 - Understand 4 Isolation Levels 00:05:48
    5. Step 62 - Choosing between Isolation Levels 00:04:03
    6. Step 63 - Implementing Transaction Management - 3 Things to Decide 00:04:38
  13. Chapter 13 : Spring Data JPA & Spring Data REST
    1. Step 64 - Introduction to Spring Data JPA 00:04:28
    2. Step 65 - Testing the Spring Data JPA Repository with findById. 00:04:13
    3. Step 66 - Spring Data JPA Repository - CRUD Methods 00:05:30
    4. Step 67 - Sorting using Spring Data JPA Repository 00:02:53
    5. Step 68 - Pagination using Spring Data JPA Repository 00:06:17
    6. Step 69 - Custom Queries using Spring Data JPA Repository 00:07:31
    7. Step 70 - Spring Data REST 00:05:14
  14. Chapter 14 : Caching with Hibernate & JPA
    1. Step 71 - Introduction to Caching and the various levels of caching in Hibernate and JPA. 00:07:16
    2. Step 72 - Hibernate and JPA Caching - First Level Cache 00:06:24
    3. Step 73 - Hibernate and JPA Caching - Basics of Second Level Cache with EhCache 00:07:32
    4. Step 74 - Hibernate and JPA Caching - Second Level Cache Part 2 00:09:26
  15. Chapter 15 : Hibernate & JPA Tips
    1. Step 75 - Hibernate Tips - Hibernate Soft Deletes - @SQLDelete and @Where 00:09:36
    2. Step 76 - Hibernate Soft Deletes - Part 2 00:06:17
    3. Step 77 - JPA Entity Life Cycle Methods 00:02:37
    4. Step 78 - Using Embedded and Embeddable with JPA 00:06:31
    5. Step 79 - Using Enums with JPA 00:06:24
    6. Step 80 - JPA Tip - Be cautious with toString method implementations 00:02:31
    7. Step 81 - JPA Tip - When do you use JPA? 00:02:09
  16. Chapter 16 : Performance Tuning Tips with Hibernate & JPA
    1. Step 82 - Performance Tuning - Measure before Tuning 00:01:56
    2. Step 83 - Performance Tuning – Indexes 00:01:44
    3. Step 84 - Performance Tuning - Use Appropriate Caching 00:02:56
    4. Step 85 - Performance Tuning - Eager vs Lazy Fetch 00:02:02
    5. Step 86 - Performance Tuning - Avoid N+1 Problems 00:08:51
  17. Chapter 17 : Few more FAQ
    1. FAQ 5 - How to connect to a different database with Spring Boot? 00:04:06
    2. FAQ 6 - Approach to design great applications with JPA? 00:02:26
    3. FAQ 7 - Good Practices for developing JPA Applications 00:04:39
  18. Chapter 18 : Congratulations
    1. Congratulations 00:01:16
  19. Chapter 19 : Appendix - Introduction to Spring Framework in 10 Steps
    1. Introduction to Spring Framework in 10 Steps 00:01:10
    2. Step 1 - Setting up a Spring Project using 00:04:49
    3. Step 2 - Understanding Tight Coupling using the Binary Search Algorithm Example 00:08:27
    4. Step 3 - Making the Binary Search Algorithm Example Loosely Coupled 00:05:22
    5. 19_5_T 00:11:31
    6. Step 5 - What is happening in the background? 00:06:28
    7. Step 6 - Dynamic auto wiring and Troubleshooting - @Primary 00:04:47
    8. Step 7 - Constructor and Setter Injection 00:04:56
    9. Step 8 - Spring Modules 00:05:05
    10. Step 9 - Spring Projects 00:04:46
    11. Step 10 - Why is Spring Popular? 00:04:15