问答详情
源自:-

老师,问题求解

<insert id="addUser" parameterType="com.zucc.zjh.entity.User">

  insert into user(username,password,status,gender,email,tel,`desc`) 

value(#{userName},#{password},#{status},#{sex},#{email},#{tel},#{desc})

  </insert>


public String getPassowrd(String userName) {

System.out.println(userName);

DBAccess dbAccess = new DBAccess();

SqlSession sqlSession = null;

String password = null;

try {

sqlSession = dbAccess.getSqlSession();

IUser ui = sqlSession.getMapper(IUser.class);

password = ui.getPassword(userName);

System.out.println(password);

//sqlSession.commit();

}

catch(IOException e) {

e.printStackTrace();

}

return password;

}


老师,我这样显示是提交成功了,但是数据库中并没有插入

https://img1.mukewang.com/5d5fbc3f00014d7a14520077.jpg

这是为什么啊,我那个commit()没有注释掉也一样

提问者:hei嘿嘿 2019-08-23 18:14

个回答