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

📄 studentdaojdbc.java

📁 Sample for Spring coding
💻 JAVA
字号:
package com.springinaction.training.dao.jdbc;

import java.util.Set;

import org.springframework.jdbc.core.support.JdbcDaoSupport;
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;

import com.springinaction.training.dao.StudentDao;
import com.springinaction.training.model.Student;


public class StudentDaoJdbc extends JdbcDaoSupport 
    implements StudentDao {
  
  public Student findById(String id) {
    throw new RuntimeException("Method not implemented yet.");
  }

  public void create(Student student) {
    
    Integer id = new Integer(incrementer.nextIntValue());
    
    getJdbcTemplate().update("insert into student (id, login, " +
            "password, firstName, middleName, lastName, " +
						"address1, address2, city, state, zip, phone, email) " +
            "values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
        new Object[] {id, student.getLogin(), 
    		student.getPassword(), student.getFirstName(), 
//        student.getMiddleName(), student.getLastName(), 
//        student.getAddress1(), student.getAddress2(), 
//        student.getCity(), student.getState(), student.getZip(), 
//        student.getPhone(), student.getEmail()
        });
    
  }

  public Set getCompletedCourses(Student student) {
    throw new RuntimeException("Method not implemented yet.");
  }
  
  private DataFieldMaxValueIncrementer incrementer;

  public void setIncrementer(DataFieldMaxValueIncrementer incrementer) {
	  this.incrementer = incrementer;
  }
}

⌨️ 快捷键说明

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