⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 coursemappingquery.java

📁 Sample for Spring coding
💻 JAVA
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -