Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

The Ultimate Guide for Spring Data JPA and Hibernate - 5 Hours Tutorial

via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
Master Spring Data JPA and Hibernate through this comprehensive 5-hour tutorial that covers everything from basic setup to advanced concepts. Learn to set up PostgreSQL and MySQL databases using Docker, create Spring Boot projects, and establish database connections. Explore entity creation and management, including annotations like @Id, @GeneratedValue, @Column, and @Table, along with various generation strategies and sequence generators. Understand the entity lifecycle and build complex relationships between entities using @ManyToMany, @ManyToOne, @OneToMany, and @OneToOne annotations. Dive deep into JPA inheritance strategies including single table, joined table, and table per class approaches, while working with polymorphic queries and embedded entities. Practice creating repositories, implementing derived queries, and using specifications for dynamic querying. Work with named queries, data modification operations, and embedded IDs while building a complete project that demonstrates real-world application of Spring Data JPA concepts. Gain hands-on experience with Java Faker for generating test data and learn best practices for data persistence in Spring Boot applications.

Syllabus

Intro
Setup postgres DB Docker
Setup MySQL DB Docker
Create a new spring boot project
Setup the DB and create a schema Postgres
Setup the DB and create a schema MySQL
Connect the application to the database Postgres
Connect the application to the database MySQL
The project we will build
Hibernate VS Spring data jpa
Create the first java class
Transform the Java class to an Entity
@Id annotation
@GeneratedValue annotation
Strategy: Auto
@SequenceGenerator annotation
@TableGenerator annotation
@Column annotation overview
Usage of @Colum annotation
@Table annotation
Repository overview
Depp understanding of repositories
Discover the repositories as code
Create the first repository
Create a command line runner bean
Insert some data into the DB
Entity lifecycle
Why creating relationships between entities
The difference between unidirectional and bidirectional relationship
Create the course entity
Create the section entity
Create the lecture entity
Create the resource entity
@ManyToMany relationship
@ManyToOne relationship
One to many between section and lecture
@OneToOne relationship
Check if your code is correct
JPA Inheritance overview
Inheritance over composition
@MappedSuperClass
Create the child classes
Single table strategy
Single table discriminator value
Test single table strategy
Joined table strategy
Table per class strategy
Polymorphic queries
Embedded entities overview
Create embedded id class
Use the embedded ID
Test the embedded ID
Create an embeddable Address class
@Embaddable annotation
Derived queries explained
FindAllBy explained
Playing with findBy method
Add Java faker dependency
Insert fake data
Exercise
Exercise - Solution - Update a field
Update data with @Modifiying
@MamedQueries definition
Select data with named query
Update data with named queries
Specification overview
Extend the repository
Building the specification
Execute the specification

Reviews

Start your review of The Ultimate Guide for Spring Data JPA and Hibernate - 5 Hours Tutorial

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.