-
Notifications
You must be signed in to change notification settings - Fork 300
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
[JDBC 라이브러리 구현하기 - 3,4단계] 도치(김동흠) 미션 제출합니다. #529
Conversation
깊이 고민하고 리뷰해 주셔서 감사합니다! |
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.
도치 구현하느라 고생하셨습니다!
커멘트 몇개만 남겨봤어요 확인해주시고 답변 달아주신 후 리뷰요청 다시 부탁드립니다!
} | ||
|
||
@Override | ||
public User findById(long id) { |
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.
findById랑 insert에는 트랜잭션을 적용하지 않은 이유가 있을까요?
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.
여기도 트랜잭션 적용하는 게 좋을 것 같아요!
@@ -1,6 +1,6 @@ | |||
create table if not exists users ( | |||
id bigint auto_increment, | |||
account varchar(100) not null, | |||
account varchar(100) not null unique, |
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.
👍
if (resources.get() == null) { | ||
return null; | ||
} | ||
return resources.get().get(key); |
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.
key가 keySet()에 없는 경우는 어떻게 되나요?
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.
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.
앗 null을 반환하는 거면 그대로 두어도 될 것 같아요!
public static void close(DataSource dataSource, Connection connection) { | ||
try { | ||
DataSourceUtils.releaseConnection(connection, dataSource); | ||
TransactionSynchronizationManager.unbindResource(dataSource); |
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.
그럴리는 없겠지만... unbind된 connection이 파라미터로 들어온 connection이랑 다른 경우는 어떻게 되나요?
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.
unbind할 때는 스레드로컬로부터 같은 dataSource를 통해 connection을 가져오기에 그럴 일이 없을 것 같기는 하네요! 흠.. 그래도 안전장치를 마련하자면 connection을 가져온 후 닫혔는지 확인 후 unbind하는 게 더 좋을 것 같아 그렇게 수정하겠습니다
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.
고생하셨습니다 도치! 열심히 구현해주셨네요!
말씀드린 부분 잘 반영해주셔서 이상 머지하겠습니다~~
JDBC 라이브러리 구현 미션 고생하셨습니다!
안녕하세요 리오!
3,4단계 같이 리뷰요청 드립니다.
말했던 account관련한 것은 unique제약을 걸고, 테스트에서는 deleteAll로 초기화를 해주고, insert후 해당 user 조회를 위해 updateAndReturnKey를 구현해 id를 반환받는 식으로 해결해보았어요