Skip to content

Commit

Permalink
Merge pull request #100 from kakao-tech-campus-2nd-step3/feature/99-log
Browse files Browse the repository at this point in the history
feat: 비관적 락 제거 및 로그 추가
  • Loading branch information
peeerr authored Nov 12, 2024
2 parents 1c54d2b + 9fdbd16 commit e6b8e6e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.potatocake.everymoment.repository;

import com.potatocake.everymoment.entity.Member;
import jakarta.persistence.LockModeType;
import java.util.Optional;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.ScrollPosition;
import org.springframework.data.domain.Window;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.data.jpa.repository.Query;

public interface MemberRepository extends JpaRepository<Member, Long> {
Expand All @@ -18,7 +16,6 @@ public interface MemberRepository extends JpaRepository<Member, Long> {

Window<Member> findByNicknameContaining(String nickname, ScrollPosition position, Pageable pageable);

@Lock(LockModeType.PESSIMISTIC_WRITE)
@Query("SELECT CASE WHEN MIN(m.number) > 0 OR MIN(m.number) IS NULL THEN -1 ELSE MIN(m.number) - 1 END FROM Member m")
Long findNextAnonymousNumber();

Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ spring:
hibernate:
jdbc:
time_zone: Asia/Seoul
format_sql: true
show-sql: true
hibernate:
ddl-auto: none

Expand All @@ -22,6 +24,14 @@ spring:
max-request-size: 25MB
resolve-lazily: true

logging:
level:
org:
hibernate:
orm:
jdbc:
bind: trace

aws:
s3:
client: AmazonS3
Expand Down

0 comments on commit e6b8e6e

Please sign in to comment.