xml配置
<!--更新用户 --> <update id="updateUserById" parameterType="com.itheima.mybatis.pojo.User"> update user set username = #{username},sex = #{sex}, birthday = #{birthday},address = #{address} where id = #{id} </update>
测试
//创建用户 User u=new User(); u.setAddress("useradd"); u.setBirthday(new Date()); u.setSex("男"); u.setUsername("张三"); //更新 int account = sqlSession.update("", ""); sqlSession.commit();