Skip to content

[3단계 - Transaction 적용하기] 레디(최동근) 미션 제출합니다. #836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Oct 14, 2024

Conversation

reddevilmidzy
Copy link
Member

안녕하세요 초코칩!!

리팩터링하고 싶은 부분들이 많았지만 다음 단계로 미루고 구현에 집중하였습니다..!

이번 리뷰도 잘 부탁드립니다 :)

@reddevilmidzy reddevilmidzy self-assigned this Oct 13, 2024
Copy link

@Chocochip101 Chocochip101 left a comment

Choose a reason for hiding this comment

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

빠르게 구현해주셨네요, 레디!

리뷰 남겼으니 확인 부탁드려요 😄

user.changePassword(newPassword);
userDao.update(user);
userHistoryDao.log(new UserHistory(user, createBy));
try (final Connection connection = dataSource.getConnection()) {

Choose a reason for hiding this comment

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

Datasource로부터 커넥션을 가져오는 로직을 UserService에서 제거해보는 것은 어떤가요?

Copy link
Member Author

Choose a reason for hiding this comment

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

넵! UserService에서 커넥션을 가져오는 책임을 transactionManager에게 넘겨주었습니다..! 변경한 코드가 썩 마음에 들지는 않지만 4단계 때 더 발전시켜보겠습니닷 😃

@@ -34,7 +35,7 @@ public String getAccount() {
return account;
}

public long getId() {
public Long getId() {

Choose a reason for hiding this comment

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

변경하신 이유가 있나요?

Copy link
Member Author

Choose a reason for hiding this comment

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

현재 id의 타입은 Long으로 null이 허용되는데 getter의 리턴 타입이 long primitive 타입으로 되어있으면 이 메서드 호출시에 타입 캐스팅에 실패하여 NPE가 발생하게 되어 변경해주었습니다!

Comment on lines 18 to 20
connection.setAutoCommit(false);
runnable.run();
connection.commit();

Choose a reason for hiding this comment

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

autoCommit을 다시 true로 설정할 필요는 없을까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

오오 맞네요..!!
setAutoCommit false 하기 전에 있던 autoCommit 값을 가져와 다시 원복 해주었습니다!

Copy link

@Chocochip101 Chocochip101 left a comment

Choose a reason for hiding this comment

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

레디의 의견 잘 들었고, 피드백 빠르게 해주셨네요👍

4 단계까지 화이팅입니다🙌🏻

@Chocochip101 Chocochip101 merged commit bbd251a into woowacourse:reddevilmidzy Oct 14, 2024
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