spring之jdbcTemplate实例(三)

2015-07-20 17:19:10 来源: 作者: 浏览: 15
rson getDeletePerson() {
return deletePerson;
}

public void setDeletePerson(DeletePerson deletePerson) {
this.deletePerson = deletePerson;
}
public int delete (Person person){
System.out.println("执行persondelete");
return deletePerson.delete(person);

}
}

?

6、配置文件





com.mysql.jdbc.Driver





root



admin



















?







?

7、测试类

/**
*
*/
package com.test;

import java.util.List;
import java.util.Map;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.inspur.jdbcMapper.MyDelete;
import com.inspur.jdbcMapper.MyInsert;
import com.inspur.jdbcMapper.MySelect;
import com.inspur.jdbcMapper.Person;

import junit.framework.TestCase;
/**
*@author WHD
*2014-10-4
*/
public class TestDisk extends TestCase{

public void testSpring(){
ApplicationContext act = new ClassPathXmlApplicationContext("appMapper.xml");
MyInsert myinsert= (MyInsert)act.getBean("myInsert");
MyDelete myDelete=(MyDelete)act.getBean("myDelete");
Person p= new Person();
p.setAge(8);
p.setName("name8");
myinsert.tell();
myinsert.insert(p);
myDelete.delete(p);
System.out.println("结束");
}

}

?

?

-->

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: