sqlsession was not registered
时间: 2024-04-25 16:25:31 浏览: 39
引用\[1\]:在做ssm整合项目中出现了这样的问题 出现了这样的错误信息 SqlSession \[org.apache.ibatis.session.defaults.DefaultSqlSession@ec18b38\] was not registered for synchronization because synchronization is not active JDBC Connection \[com.mysql.jdbc.JDBC4Connection@749d2bf5\] will not be managed by Spring 。
引用\[3\]:在搞SpringBoot项目的时候,把Mybatis打印日志的配置打开后,发现每条Sql打印的时候都会在前面打印如下的信息,强迫症受不了,得查查为什么; Creating a new SqlSession SqlSession \[org.apache.ibatis.session.defaults.DefaultSqlSession@521978e4\] was not registered for synchronization because synchronization is not active JDBC Connection \[com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@5bb2b956\] will not be managed by Spring ==> Preparing: select * from xxx where xxx = ? and xxx = ? ==> Parameters: opHQA5gq2qfn1DRl069YOLv1Wv0Q(String), 0(Integer) <== Columns: xxx, xxx, xxx, xxx <== Row: xxx, xxx, xxx, xxx <== Total: 1 Closing non transactional SqlSession \[org.apache.ibatis.session.defaults.DefaultSqlSession@521978e4\] 。
问题:sqlsession was not registered for synchronization是什么意思?
回答: 当出现"sqlsession was not registered for synchronization"的错误信息时,意味着在当前的上下文中,没有为SqlSession注册事务同步。这通常是因为没有启用事务管理或者事务同步未激活所导致的。在这种情况下,JDBC连接也不会被Spring管理。\[1\]这个问题通常出现在整合Spring和MyBatis的项目中,可能是由于配置错误或者缺少必要的事务管理器所引起的。如果你想要解决这个问题,你可以检查你的项目配置,确保正确配置了事务管理器,并且在需要的地方启用了事务。\[1\]\[3\]
#### 引用[.reference_title]
- *1* [SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@ec18b38] was not registered for syn](https://blog.csdn.net/weixin_45765073/article/details/127797364)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* *3* [SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@xxx] was not registered for synchro](https://blog.csdn.net/csdn_avatar_2019/article/details/126128441)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control_2,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)