JPA and Hibernate
How JPA and Hibernate map Java objects to database tables: entities and annotations, the persistence context and dirty checking, relationships, lazy and eager loading, the N+1 query problem and its fixes, Spring Data repositories, transactions, and the common pitfalls.
CodexBash, , 5 min read
Writing SQL by hand for every insert, update and query, then copying columns into Java objects and back, is repetitive and error-prone. JPA (Jakarta Persistence API) is the Java standard for object-relational mapping: you annotate ordinary classes, and the framework stores and loads them for you. Hibernate is the most widely used implementation of JPA, and it is what Spring Boot uses by default. This article explains how it works underneath, because nearly every JPA performance problem comes from not knowing what SQL it generates.
Sign in to read the rest
The whole 5 minute article is free with an account, along with every problem, lesson and tutorial. No card.