Student.xml
<update id="updateStudent" parameterClass="Student" > UPDATE Student SET age=#age# WHERE (Id=#id#) </update>
StudentImpl.java
public void upStudent(Student student) { // TODO Auto-generated method stub try { sqlMapClient.update("updateStudent",student); } 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 Student student = new Student(); student.setId(1); student.setAge(50); IStudent istudent5 = new StudentImpl(); istudent5.upStudent(student); } }
时间: 2024-11-08 03:27:57