Skip to content

Conversation

@msung99
Copy link

@msung99 msung99 commented Aug 13, 2024

haon(하온) JDBC 미션 제출합니다 🙂

Copy link

@swandevson swandevson left a comment

Choose a reason for hiding this comment

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

LGTM
고생하셨습니다!

public int count() {
//TODO : customers 디비에 포함되어있는 row가 몇개인지 확인하는 기능 구현
return 0;
return jdbcTemplate.queryForObject("select count(*) from customers", Integer.class);

Choose a reason for hiding this comment

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

가독성을 위해 SQL 예약어(SELECT, FROM 등)은 대문자로 작성하시는 것이 좋을 것 같습니다!

Copy link

@alreadysons alreadysons left a comment

Choose a reason for hiding this comment

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

하온~~ 고생하셨습니다!!

//todo : keyHolder에 대해 학습하고, Customer를 저장후 저장된 Customer의 id를 반환하기
jdbcTemplate.update(connection -> {
PreparedStatement ps = connection.prepareStatement(
"insert into customers (first_name, last_name) values (?, ?)",

Choose a reason for hiding this comment

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

예약어는 대문자 사용이 좋아보입니다!!

Copy link
Member

@dayaelee dayaelee left a comment

Choose a reason for hiding this comment

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

목적에 맞게 코드를 잘 작성하신 것 같습니다. 고생하셨습니다!

public int delete(Long id) {
//todo: id에 해당하는 customer를 지우고, 해당 쿼리에 영향받는 row 수반환하기
return 0;
return jdbcTemplate.update("delete from customers where id = ?", Long.valueOf(id));
Copy link
Member

Choose a reason for hiding this comment

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

제가 아직 자바에 익숙치 않은데, 이렇게도 코드를 간략하게 작성할 수 있음에 감탄하고 덕분에 한 수 배워갑니다~!

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.

4 participants