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); } }
时间: 2024-10-28 04:11:19