=============== MyBatis删除记录 =============== public class StudentDaoTest { ... // 测试删除学生 @Test public void testDel() { try { // SQL会话 SqlSession session = new SqlSessionFactoryBuilder() .build(Resources.getResourceAsStream("mybatis-config.xml")) .openSession(); // 数据访问对象 StudentDao dao = session.getMapper(StudentDao.class); // 删除学生 int rows = dao.del("1001"); // 打印受影响的行数 System.out.println(rows); // 提交事务 session.commit(); } catch (IOException e) { e.printStackTrace(); } } ... } 例程:HelloMyBatis