**Problem:** `WorkoutService` suffers from massive N+1 queries during writes (looping `.findById`), and implicit Eager fetching causes N+1 on reads. **Acceptance Criteria:** - [x] Refactor `WorkoutService.buildWorkoutExercises` to fetch all exercises in a single query using `exerciseRepository.findAllById(ids)`. - [x] Change all `@ManyToOne` relationships (`WorkoutPlan.owner`, `WorkoutExercise.exercise`) to use `fetch = FetchType.LAZY`. - [x] Update the `WorkoutPlanRepository` to use `JOIN FETCH` queries when loading plans to prevent lazy-loading N+1s during API serialization.
Problem:
WorkoutServicesuffers from massive N+1 queries during writes (looping.findById), and implicit Eager fetching causes N+1 on reads.Acceptance Criteria:
WorkoutService.buildWorkoutExercisesto fetch all exercises in a single query usingexerciseRepository.findAllById(ids).@ManyToOnerelationships (WorkoutPlan.owner,WorkoutExercise.exercise) to usefetch = FetchType.LAZY.WorkoutPlanRepositoryto useJOIN FETCHqueries when loading plans to prevent lazy-loading N+1s during API serialization.