使用Mybatis添加用户时报:Setting autocommit to false on JDBC Connection

2019-01-24 15:18:13,391 0      [           main] DEBUG ache.ibatis.logging.LogFactory  - Logging initialized using 'class org.apache.ibatis.logging.log4j.Log4jImpl' adapter.
2019-01-24 15:18:13,632 241    [           main] DEBUG source.pooled.PooledDataSource  - PooledDataSource forcefully closed/removed all connections.
2019-01-24 15:18:13,636 245    [           main] DEBUG source.pooled.PooledDataSource  - PooledDataSource forcefully closed/removed all connections.
2019-01-24 15:18:13,637 246    [           main] DEBUG source.pooled.PooledDataSource  - PooledDataSource forcefully closed/removed all connections.
2019-01-24 15:18:13,637 246    [           main] DEBUG source.pooled.PooledDataSource  - PooledDataSource forcefully closed/removed all connections.
2019-01-24 15:18:13,842 451    [           main] DEBUG ansaction.jdbc.JdbcTransaction  - Opening JDBC Connection
2019-01-24 15:18:14,216 825    [           main] DEBUG source.pooled.PooledDataSource  - Created connection 242355057.
2019-01-24 15:18:14,216 825    [           main] DEBUG ansaction.jdbc.JdbcTransaction  - Setting autocommit to false on JDBC Connection [com.mysql.jdbc.JDBC4Connection@e720b71]
2019-01-24 15:18:14,219 828    [           main] DEBUG om.company.dao.UserDao.addUser  - ==>  Preparing: insert into user (username,birthday,sex,address) value (?,?,?,?) ; 
2019-01-24 15:18:14,269 878    [           main] DEBUG om.company.dao.UserDao.addUser  - ==> Parameters: 老王(String), 2019-01-24 15:18:13.825(Timestamp), 女(String), 隔壁(String)
2019-01-24 15:18:14,269 878    [           main] DEBUG om.company.dao.UserDao.addUser  - <==    Updates: 1
2019-01-24 15:18:14,276 885    [           main] DEBUG .dao.UserDao.addUser!selectKey  - ==>  Preparing: select last_insert_id(); 
2019-01-24 15:18:14,276 885    [           main] DEBUG .dao.UserDao.addUser!selectKey  - ==> Parameters: 
2019-01-24 15:18:14,301 910    [           main] DEBUG .dao.UserDao.addUser!selectKey  - <==      Total: 1

使用Mybatis添加用户时,显示添加成功,但数据库中没有添加的数据。

Sqlsession默认把自动事务提交给关闭了,开启了手动事务提交,只有把事务提交,数据才能提交到数据库。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

尘事如霜人如水

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值