Skip to content

fix(admin-group-deatil-info): add transactional annotation#89

Merged
minsoo0506 merged 1 commit intodevfrom
feat/admin-group-detail-info
Jan 30, 2026
Merged

fix(admin-group-deatil-info): add transactional annotation#89
minsoo0506 merged 1 commit intodevfrom
feat/admin-group-detail-info

Conversation

@minsoo0506
Copy link
Collaborator

@minsoo0506 minsoo0506 commented Jan 30, 2026

변경 사항

  • 지연 로딩을 고려하지 않고 코드를 짜서 다음과 같은 문제가 발생하였습니다...
org.hibernate.LazyInitializationException

이 문제는 Repository 메소드(예: findById)가 실행될 때만 잠깐 데이터베이스 세션이 열렸다가, 메소드가 끝나자마자 바로 닫히기 때문에 발생합니다. 이미 DB 세션이 닫혔는데 Service 계층에서 메서드를 호출하려고 하면 이미 연결이 끊겨서 위와 같은 에러 메시지가 뜨게 되는 거죠...

따라서 @transactional(readOnly = true)를 서비스 메서드 위에 붙여주었습니다. 위 어노테이션을 붙이게 되면 메소드 시작부터 끝까지 데이터베이스 연결(영속성 컨텍스트)을 계속 유지합니다.

스크린샷 2026-01-30 오후 7 50 13

@tember8003 tember8003 self-requested a review January 30, 2026 11:17
Copy link
Collaborator

@tember8003 tember8003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

트랜잭션 어서오고

@minsoo0506 minsoo0506 merged commit 5a23766 into dev Jan 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants