Stage 2 · Lesson 9 of 10
JPA, Hibernate and Flyway
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
- CoursePaidGrokking Relational Database Design and Modeling
Design Gurus · Intermediate · $98 one-time
The modelling and normalisation decisions that stay with a codebase for years
- CourseFreeCS50's Introduction to Databases with SQL
Harvard University · Beginner
Free course from querying through schema design, indexes, transactions and scaling
Practise
Also worth your time
- Database Indexing Explained: B-Tree, Hash, Bitmap, R-Tree, and When to Use Each (opens in a new tab)Read
B-tree and composite indexes, plus the leftmost-prefix rule that trips people up
What sits under your queries: storage engines, transactions and isolation levels