session.commit();

public static void updateStudentByStuno() throws IOException {
		//加载MyBatis配置文件(为了访问数据库)
		Reader reader = Resources.getResourceAsReader("conf.xml"); 
		SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(reader);
		SqlSession session = sessionFactory.openSession();
//		String statement = "org.lanqiao.entity.studentMapper.updateStudentByStuno";
		Student student = new Student(10,"zs",23);//修改的参数
		StudentMapper studentMapper = session.getMapper(StudentMapper.class);
		studentMapper.updateStudentByStuno(student);
		System.out.println(student);
		session.commit();
		session.close();
	}

若没有写session.commit();则更新的数据没有进行更新

进行add和update必须进行session.commit();

你可能感兴趣的:(session.commit();)