Skip to content
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단계] 후디(조동현) 미션 제출합니다. #115

Merged
merged 13 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions app/src/main/java/com/techcourse/dao/UserDao.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.techcourse.dao;

import com.techcourse.domain.User;
import java.sql.SQLException;
import java.util.List;
import javax.sql.DataSource;
import nextstep.jdbc.DataAccessException;
import nextstep.jdbc.JdbcTemplate;
import nextstep.jdbc.RowMapper;
import org.slf4j.Logger;
Expand All @@ -13,17 +11,12 @@
public class UserDao {

private static final Logger log = LoggerFactory.getLogger(UserDao.class);
private static final RowMapper<User> USER_ROW_MAPPER = rs -> {
try {
return new User(
rs.getLong(1),
rs.getString(2),
rs.getString(3),
rs.getString(4));
} catch (SQLException e) {
throw new DataAccessException();
}
};
private static final RowMapper<User> USER_ROW_MAPPER = rs -> new User(
rs.getLong(1),
rs.getString(2),
rs.getString(3),
rs.getString(4)
);

private final JdbcTemplate jdbcTemplate;

Expand Down
3 changes: 2 additions & 1 deletion jdbc/src/main/java/nextstep/jdbc/RowMapper.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package nextstep.jdbc;

import java.sql.ResultSet;
import java.sql.SQLException;

@FunctionalInterface
public interface RowMapper<T> {

T run(final ResultSet rs);
T run(final ResultSet rs) throws SQLException;
Copy link

Choose a reason for hiding this comment

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

👍

}