Hibernate: Myths & Over-Engineering. ORMs vs SQL vs Hexagonal β Gavin King
Description
πΊ Note: This episode contains screensharing and live coding examples that work best visually. If youβd like to follow along, check out the full video version on YouTube: https://youtu.be/Qvh3VFlvJnE.
Gavin King (creator of Hibernate) joins Marco to cut through the myths of Java persistence. When should you skip layers of repositories and just write SQL, or even model database views? What actually causes lazy-loading pain, and how do stateless sessions help? We cover Hibernate, JPA, and where Jakarta Data is headed, plus pragmatic advice for legacy schemas, performance, and keeping your code DRY.
π‘ Topics in this episode:
β’ SQL vs repositories (and why views can be your adapter layer)
β’ The three inheritance strategies, and the trap of table-per-class
β’ Stateless sessions vs stateful persistence contexts
β’ LazyInitializationException explained (and avoided)
β’ DRY first: let architecture emerge via refactoring
β’ Jakarta Data 1.0/1.1: annotation processing, stateful repos, dynamic queries
β’ Performance rule-of-thumb: minimize round-trips
β±οΈ Timestamps
(00:00 ) Teaser
(01:00 ) Gavin King intro and early Hibernate motivation
(03:59 ) Old-school open-source culture and discovery
(08:39 ) SQL isnβt hard: minimize DB round-trips
(10:03 ) βLeaky abstractions are goodβ (and why)
(12:04 ) Architecture should emerge from code
(15:44 ) DRY as commandment #1
(22:05 ) Reviewing a typical Spring Data setup (and pitfalls)
(25:39 ) Inheritance strategies: joined vs single table vs table-per-class
(30:06 ) One screen? Just write a SQL query (pragmatism)
(33:08 ) When ORM shines: operations over graphs
(35:22 ) Use views to adapt messy legacy schemas
(43:18 ) Jakarta Data repos: annotation-driven, step-into-able
(44:59 ) Stateless Session: less magic, explicit updates
(48:51 ) Jakarta Data 1.1: stateful repos, dynamic queries, reactive
(01:24:22 ) Rapid fire questions
(01:33:15 ) Features Gavin would delete and lessons learned
(01:42:30 ) Giveaway
New episodes every other Wednesday. Subscribe for deep, developer-focused conversations.