Why Misusing JPA findById Hurts Performance and Causes Critical Pitfalls
The article dissects how the default JpaRepository findById method can trigger unnecessary SELECT queries, create foreign‑key violations under concurrency, and degrade performance, then demonstrates three concrete workarounds—including getReferenceById, manual entity construction, and pessimistic read locking—to eliminate these issues.
