コード例 #1
0
 @Override
 protected void preparedStatementForInsert(PreparedStatement statement, Student object)
     throws SQLException {
   statement.setString(1, object.getFirstName());
   statement.setString(2, object.getSecondName());
   statement.setInt(3, object.getEnterYear());
 }
コード例 #2
0
 @Override
 protected List<Student> parseResultSet(ResultSet rs) throws SQLException {
   List<Student> result = new LinkedList<>();
   while (rs.next()) {
     Student student = new Student();
     student.setId(rs.getInt("ID"));
     student.setFirstName(rs.getString("first_name"));
     student.setSecondName(rs.getString("second_name"));
     student.setEnterYear(rs.getInt("enter_year"));
     result.add(student);
   }
   return result;
 }