Backend development

Stage 2 · Lesson 9 of 10

JPA, Hibernate and Flyway

Relational databases and SQL

JPA is the standard Java way to map classes to database tables. is the that does the work underneath by default. An @Entity class maps to a table.

@ManyToOne and @OneToMany map relationships between tables. A interface that extends JpaRepository writes queries for you from method names, such as findByEmail. For schema changes, use , or Liquibase.

You write numbered SQL files such as V3__add_order_status.sql in src/main/resources/db/migration. They run in order, and Flyway records which ones have run.

Common trapletting Hibernate manage the schema with ddl-auto=update. It cannot rename columns or move data safely, so set it to validate and let Flyway own every change.

A question to check yourself, an AI practice session and 2 cheat sheet entries come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Practise

Also worth your time

Mark this stage as not done?