coursemappingquery.java

来自「spring in action 源代码」· Java 代码 · 共 31 行

JAVA
31
字号
package com.springinaction.training.dao.jdbc;

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

import javax.sql.DataSource;

import org.springframework.jdbc.object.MappingSqlQuery;

import com.springinaction.training.model.Course;


public class CourseMappingQuery extends MappingSqlQuery {

  CourseMappingQuery(DataSource dataSource, String sql) {
    super(dataSource, sql);
    compile();
  }

  protected Object mapRow(ResultSet rs, int rowNum) 
      throws SQLException {
  	Course course = new Course();
    course.setId(new Integer(rs.getInt("id")));
    course.setName(rs.getString("name"));
    course.setDescription(rs.getString("description"));
    course.setStartDate(rs.getDate("startDate"));
    course.setEndDate(rs.getDate("endDate"));
    return course;
  }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?