• 카테고리

    질문 & 답변
  • 세부 분야

    백엔드

  • 해결 여부

    미해결

OptimisticLock 관련 질문이 있습니다.

22.10.04 01:37 작성 조회수 279

0

안녕하세요 좋은 수업 올려주셔서 감사합니다.

현재 Test를 돌리게 되면 99 에서 무한 루프에 빠지게 됩니다.
version 이 업데이터 되지 않고 실행이되어 여러 질문 게시판에 올려진 문제중 하나인 core 갯수 문제인지 했느데 그것 또한 되지 않아 말씀 질문 드립니다.

https://github.com/Eco-Min/-concurrency_issue.git

 

2022-10-04 01:28:05.898 DEBUG 7468 --- [ Test worker] org.hibernate.SQL : insert into stock (product_id, quantity, version) values (?, ?, ?)

Hibernate: insert into stock (product_id, quantity, version) values (?, ?, ?)

2022-10-04 01:28:05.907 TRACE 7468 --- [ Test worker] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:05.907 TRACE 7468 --- [ Test worker] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [BIGINT] - [100]

2022-10-04 01:28:05.907 TRACE 7468 --- [ Test worker] o.h.type.descriptor.sql.BasicBinder : binding parameter [3] as [BIGINT] - [0]

2022-10-04 01:28:05.996 DEBUG 7468 --- [pool-1-thread-2] org.hibernate.SQL : select stock0_.id as id1_0_, stock0_.product_id as product_2_0_, stock0_.quantity as quantity3_0_, stock0_.version as version4_0_ from stock stock0_ where stock0_.id=?

Hibernate: select stock0_.id as id1_0_, stock0_.product_id as product_2_0_, stock0_.quantity as quantity3_0_, stock0_.version as version4_0_ from stock stock0_ where stock0_.id=?

2022-10-04 01:28:05.997 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:06.021 DEBUG 7468 --- [pool-1-thread-2] org.hibernate.SQL : update stock set product_id=?, quantity=?, version=? where id=? and version=?

Hibernate: update stock set product_id=?, quantity=?, version=? where id=? and version=?

2022-10-04 01:28:06.022 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:06.022 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [BIGINT] - [99]

2022-10-04 01:28:06.022 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [3] as [BIGINT] - [1]

2022-10-04 01:28:06.023 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [4] as [BIGINT] - [1]

2022-10-04 01:28:06.023 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [5] as [BIGINT] - [0]

2022-10-04 01:28:06.026 DEBUG 7468 --- [pool-1-thread-2] org.hibernate.SQL : select version as version_ from stock where id =?

Hibernate: select version as version_ from stock where id =?

2022-10-04 01:28:06.026 DEBUG 7468 --- [pool-1-thread-1] org.hibernate.SQL : select stock0_.id as id1_0_, stock0_.product_id as product_2_0_, stock0_.quantity as quantity3_0_, stock0_.version as version4_0_ from stock stock0_ where stock0_.id=?

Hibernate: select stock0_.id as id1_0_, stock0_.product_id as product_2_0_, stock0_.quantity as quantity3_0_, stock0_.version as version4_0_ from stock stock0_ where stock0_.id=?

2022-10-04 01:28:06.027 TRACE 7468 --- [pool-1-thread-2] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:06.027 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:06.030 DEBUG 7468 --- [pool-1-thread-1] org.hibernate.SQL : update stock set product_id=?, quantity=?, version=? where id=? and version=?

Hibernate: update stock set product_id=?, quantity=?, version=? where id=? and version=?

2022-10-04 01:28:06.031 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1]

2022-10-04 01:28:06.031 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [BIGINT] - [99]

2022-10-04 01:28:06.031 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [3] as [BIGINT] - [1]

2022-10-04 01:28:06.031 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [4] as [BIGINT] - [1]

2022-10-04 01:28:06.032 TRACE 7468 --- [pool-1-thread-1] o.h.type.descriptor.sql.BasicBinder : binding parameter [5] as [BIGINT] - [0]

 

답변 1

답변을 작성해보세요.

1

민경재님의 프로필

민경재

질문자

2022.10.04

죄송합니다 원인은 찾게 되었습니다.

facade 에 @Transaction 을 걸어 놨었네요 죄송합니다

다행입니다!

궁금한거 생기면 다시 질문주세요 :)