-
Notifications
You must be signed in to change notification settings - Fork 0
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
[이한솔][Week2] 웹 백엔드 과제 #7
base: main
Are you sure you want to change the base?
Conversation
this.name = name; | ||
this.phone = phone; | ||
this.companyName = companyName; | ||
this.createDate = new Date(); |
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.
생성자가 생성되는 시점에 Date값이 초기화되는 것을 인지해야합니다.
BusinessCard card = new BusinessCard() // 이 시점의 시간이 저장됨
String phone = rs.getString(2); | ||
String companyName = rs.getString(3); | ||
|
||
BusinessCard businessCard = new BusinessCard(name,phone,companyName); |
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.
이 시점에 date값이 초기화되기 떄문에 사용자에게 보여질때 생성된 시점이 아니라 호출된 시점의 시간이 보여지겠죠. 또 호출될 때마다 시간이 다르게 보일겁니다.
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.
IDE들에서 라인포매팅을 잘 지원해주고 있어요!
PreparedStatement ps = conn.prepareStatement(sql)){ | ||
ps.setString(1, businessCard.getName()); | ||
ps.setString(2, businessCard.getPhone()); | ||
ps.setString(3, businessCard.getCompanyName()); |
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.
Date값이 안들어가 있네요~
DB에 date 관련된 타입의 컬럼 추가 하시고, 값한번 넣어보면서 테스트해보세요
참고: https://blog.naver.com/jihye2340/220633994462
과제 내용 요약
어려웠던 점
코드 리뷰 받고 싶은 부분