재고 차감 기능을 구현할 때, JPQL UPDATE 문을 사용하면 재고를 원자적으로 감소시킬 수 있다.예를 들어 다음과 같은 방식이다.@Modifying@Query(""" UPDATE Product p SET p.stockQuantity = p.stockQuantity - :quantity WHERE p.id = :productId AND p.stockQuantity >= :quantity""")int decreaseStockAtomic(Long productId, Integer quantity);위 쿼리는:상품 ID가 존재하고재고가 충분한 경우에만재고를 감소시킨다.그렇다면 findById()는 불필요할까?주문 생성 로직에서 다음과 같은 코드가 존재할 수 있다.Product pr..