iBatis 的删除一条记录

Student.xml 设置删除参数的类型,可以是一个对象的

    <delete id="delStudent" parameterClass="int" >
DELETE FROM Student WHERE (Id=#id#)
</delete>

StudentImpl.java   调用删除方法

    public void delStudent(int id) {
// TODO Auto-generated method stub
try {
sqlMapClient.delete("delStudent",id);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }

Test.java

package cn.test.main;

import java.util.List;

import cn.test.domain.Student;
import cn.test.service.IStudent;
import cn.test.service.StudentImpl; public class Test { /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
IStudent istudent4 = new StudentImpl();
istudent4.delStudent(2); } }
上一篇:如何在eclipse dump Java内存占用情况和打印GC LOG


下一篇:离线安装redis-cluster