-
Notifications
You must be signed in to change notification settings - Fork 301
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 구현하기 - 1단계] 도기(김동호) 미션 제출합니다. #337
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.
안녕하세요 도기 🙌
같은 신림인과 함께되어서 반갑네요 ㅎㅎㅎ
최근에 코딩만 하느라 하늘을 못본지 얼마나 된지 모르겠습니다...🥹(아 내 낭만..)
도기는 추석 잘보내시고 있는거 같아 좋아보이네요!
1단계때는 코드를 많이 작성할게 없는 줄 알았는데 도기 코드를 보니 좀 생각이 달라지네요. 꼼꼼하게 정말 잘 작성해주신거 같아요 👍🏻👍🏻
요구사항은 다 만족하신거 같아 머지하면 될 것 같고 코멘트 한번씩 확인 해주시면 좋을 것 같습니다! 그럼 다음 단계때 봐요!
do { | ||
result.add(rowMapper.mapRow(resultSet)); | ||
} while (resultSet.next()); |
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.
while (resultSet.next()) {
...
}
로 하면 밖에서의 If문도 제거하고 do while도 바꿀 수 있을거 같아요!
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.
와우 너무 좋은데요 !
List<T> result = query(sql, rowMapper, params); | ||
if (result.size() != 1) { | ||
throw new DataAccessException("Result Count is Not Only 1. ResultCount=" + result.size()); | ||
} |
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.
와우 query 재활용에다가 꼼꼼한 에러 처리까지 👍🏻👍🏻
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.
체스 미션땐가 query와 queryForObject의 차이에 대해 깊게 공부한 덕을 보네요 😆
} | ||
|
||
public <T> T queryForObject(final String sql, final RowMapper<T> rowMapper, final Object... params) { | ||
List<T> result = query(sql, rowMapper, params); |
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.
final이 붙은 곳도 있고 안 붙은 곳도 있는거 같아서 전체적으로 통일시켜주면 더 좋을 것 같아요!
import javax.sql.DataSource; | ||
import java.sql.Connection; | ||
import java.sql.PreparedStatement; | ||
import java.sql.SQLException; | ||
|
||
public class UserHistoryDao { |
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.
어.. 이거보니 생각났는데 저는 HistoryDao는 안 고쳐줬네요ㅋㅋㅋ
꼼꼼도기 👍🏻
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
@FunctionalInterface |
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.
🚀
} | ||
} | ||
|
||
private DatabasePopulatorUtils() {} | ||
public static void clear(final DataSource 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.
clear까지 구현해놓으셨군요 🚀
아래 코드에서 궁금한게 있어요. var을 적용하는 변수의 기준이 있는지 궁금합니다!
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.
사실 원래 var를 잘 적용하지 않는데요. 미션 코드에서 var를 사용하길래 통일성을 위해 사용했습니다.
안녕하세요 무민! 만나서 반갑습니다 🙇♂️
추석 연휴는 잘 보내고 계신가요? 어제 달이 진짜 크던데 보셨는지 모르겠네요.
처음에 어디서부터 어디까지 구현해야할 지 감이 안와서 Oracle 공식문서 보고 감을 잡았습니다.
UserDaoTest의 경우도 제 입맛대로 단언문을 바꿔보았어요.
그에 따라 요구사항에는 존재하지 않지만 DB를 clean up 해주는 메서드도 구현하게 된 점 미리 말씀드립니다.
그럼 잘 부탁드립니다 👍