Tag: 백엔드공부
All the articles with the tag "백엔드공부".
-
Spring Boot #4 — Transactions, Relationships, N+1, and Fetch Join
I connected entities with @ManyToOne and ran a full query, and instead of 1 query, 6 came out. I fixed the N+1 problem caused by LAZY loading with fetch join, and worked through the atomicity and dirty checking of @Transactional.
-
Spring Boot #3 — Connecting PostgreSQL with JPA · CRUD with Entities and Repositories
I replaced the in-memory List CRUD with an actual PostgreSQL setup. From build.gradle dependencies to application.properties, from record to @Entity, why JpaRepository is an empty interface but CRUD still works, and the dividend of layer separation where I didn't change a single line in the controller.
-
PostgreSQL Basics — CRUD and the Korean Sorting (COLLATE) Trap
I'd only used SQLite before, so this was my first time touching PostgreSQL. From CREATE to mapping CRUD, and the collation problem where ORDER BY wouldn't sort Korean text alphabetically.
-
Spring Boot #2 — CRUD with REST API · Layered Architecture · Global Exception Handler
Following Spring Boot #1 (first run · DI), #2 covers CRUD with REST API. Starting from the definition that REST is a combination of URL + HTTP method (GET/POST/PUT/DELETE), I completed todos CRUD by attaching @GetMapping · @PostMapping · @PutMapping · @DeleteMapping to the controller. I organized curl options (-X method · -H format · -d data) and verified the flow with a 5-step curl sequence (create → list all → update → delete → final check). Since the controller was holding all the logic, I split it into a service → layered architecture (Controller = request/response / Service = logic / Repository = storage). For exception handling: custom exception → 404 response, and with a Global Exception Handler in place, the controller just throws while the handler takes care of the response mapping — extending into practice the "throw forces propagation" contract I learned in the Java #3 post. Two trial-and-error incidents (trying to start the server without a referenced class present · writing package code before adding the library) got folded into my study guidelines to prevent recurrence.