Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clearAutomatically = true옵션을 제거하면 벌크 삭제 연산 후에도 영속성 컨텍스트가 유지되어LazyInitializationException을 방지할 수 있지만, 영속성 컨텍스트와 데이터베이스 간의 데이터 불일치(Stale State) 문제가 발생할 수 있는 점에 유의해야 합니다. 특히Promise엔티티가CandidateVote엔티티들과@OneToMany관계를 맺고 있고 해당 컬렉션이 이미 영속성 컨텍스트에 로드되어 있다면, DB에서 삭제된 데이터가 메모리상의 컬렉션에는 여전히 남아있게 됩니다. 이 트랜잭션의 남은 로직에서 해당 컬렉션을 참조하거나 삭제된 엔티티를 다시 조회하지 않는지 확인이 필요하며, 만약 데이터 정합성이 중요하다면 연산 후 필요한 엔티티를 명시적으로 다시 조회하는 방안을 고려해 보시기 바랍니다.