File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -104,15 +104,15 @@ Optional<Inventory> findByProductIdWithPessimisticLock(Long productId);
104104
105105row별로 버전 컬럼을 사용하여 동시성 문제를 해결합니다.
106106
107- {% tabs log %}
107+ {% tabs OPTIMISTIC %}
108108
109- {% tab log 낙관적 락 흐름 %}
109+ {% tab OPTIMISTIC 낙관적 락 흐름 %}
110110```
111111🔓 DB 락 없이 조회 → ✏️ @Version 으로 체크 → 💥 충돌 시 예외 → 🔄 앱에서 재시도
112112```
113113{% endtab %}
114114
115- {% tab log Entity %}
115+ {% tab OPTIMISTIC Entity %}
116116```java
117117public class Inventory {
118118 ...
@@ -126,15 +126,15 @@ public class Inventory {
126126```
127127{% endtab %}
128128
129- {% tab log JPA Repository %}
129+ {% tab OPTIMISTIC JPA Repository %}
130130``` java
131131@Lock (LockModeType . OPTIMISTIC )
132132@Query (" SELECT i FROM Inventory i WHERE i.product.id = :productId" )
133133Optional<Inventory > findByProductIdWithOptimisticLock(Long productId);
134134```
135135{% endtab %}
136136
137- {% tab log Service Code %}
137+ {% tab OPTIMISTIC Service Code %}
138138``` java
139139public class CreateOrderWithOptimisticLockUseCase {
140140 private final OrderRepository orderRepository;
You can’t perform that action at this time.
0 commit comments