JPA Articles
Articles covering JPA relationship mapping, query methods, transactions, and performance optimization for data access design.
-
Implementing CRUD REST API with Spring Boot - Basic Structure of Controller, Service, and Repository
A step-by-step guide to implementing CRUD (Create, Read, Update, Delete) REST API with Spring Boot. Build the three-layer architecture of Controller, Service, and Repository from scratch, and walk through setting up all four endpoints: GET, POST, PUT, and DELETE.
-
Which Should You Choose in Spring Boot: MyBatis or JPA? - Selection Criteria and Combined Usage Patterns
Are you unsure whether to choose MyBatis or JPA for your Spring Boot project? This article provides a thorough comparison of both from the perspectives of SQL control flexibility, learning cost, and maintainability, and presents practical selection criteria such as JPA for CRUD-focused use cases and MyBatis for complex reporting screens. Also covers how to implement a combined usage pattern.
-
Understanding Transaction Management with @Transactional in Spring Boot - How to Use Propagation Levels and Isolation Levels
A comprehensive guide to transaction management using the @Transactional annotation in Spring Boot, from basics to practical usage. Covers default behavior, all 7 propagation levels, 4 isolation levels, and common failure patterns where rollback does not work (checked exceptions, self-invocation) with real examples.
-
Have You Ever Been Unsure How to Write Spring Data JPA Query Methods?
A step-by-step explanation of Spring Data JPA query method naming conventions and usage (findBy, existsBy, etc.) with practical examples. Covers combining multiple conditions, sorting, pagination, and custom queries using @Query, including common pitfalls for beginners.
-
How to Map Entity Relationships with JPA in Spring Boot - Using @OneToMany and @ManyToOne
A beginner-friendly guide to correctly mapping relationships between entities (@OneToMany, @ManyToOne, @ManyToMany) with JPA in Spring Boot. Covers the differences between bidirectional and unidirectional associations, cascade configuration, choosing FetchType, and practical approaches to avoiding the N+1 problem and circular references.