SqlSession was not registered for synchronization because synchronization is not active

SSM框架,前端页面插入新增用户数据时 SQL 语句可以正常执行,无法提交,并且给出下面两条信息。

由于我是跟着b站的 《走向单体地狱》这个视频敲的代码,所以各个配置文件按道理来说是没问题的。

一开始不敢肯定是自己的代码错误,在网上搜索了下面两条信息,所有方法基本都是围绕 配置Spring 事务管理 ,即 @Transactional注解 来说,我查看尝试了3页百度结果,都没用。

SqlSession was not  registered for synchronization because synchronization is not active

JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@6d8169e8] will not be managed by Spring

SqlSession was not registered for synchronization because synchronization is not active

 接着开始翻看以前的视频,发现我是将实体类 TbUser 的属性 ID 的类型写成了 int ,原视频是 Long 类型。更改完属性类型后插入数据成功。

SqlSession was not registered for synchronization because synchronization is not activeSqlSession was not registered for synchronization because synchronization is not active

 

 SqlSession was not registered for synchronization because synchronization is not active

 

SqlSession was not registered for synchronization because synchronization is not active

上一篇:mysql-slow.log-慢查询日志清理


下一篇:09 spark连接mysql数据库