Skip to content

Instantly share code, notes, and snippets.

@msbaek
Created December 21, 2025 03:41
Show Gist options
  • Select an option

  • Save msbaek/f81488307c0346e338f5c7b71b8b77f4 to your computer and use it in GitHub Desktop.

Select an option

Save msbaek/f81488307c0346e338f5c7b71b8b77f4 to your computer and use it in GitHub Desktop.
더티 체킹의 함정
@Transactional
public void updateName(Long id, String newName) {
User user = userRepository.findById(id).orElseThrow();
user.setName(newName);
// 여기서 마법이 일어난다. save() 없이도 DB가 업데이트된다.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment