오류
Incorrect result size: expected 1, actual 0
내용
public boolean isDeptno(int deptno) {
String sql = "SELECT * FROM dept WHERE deptno=?";
return jdbcTemplate.queryForObject(sql, (rs,i)->{
return rs.getString("deptno");
},deptno)!=null;
}
해결
public boolean isDeptno(int deptno) {
String sql = "SELECT * FROM dept WHERE deptno=?";
try {
jdbcTemplate.queryForObject(sql, (rs, i) -> {
return rs.getString("deptno");
}, deptno);
return true;
} catch (Exception e) {
return false;
}
}