was not registered for synchronization because synchronization is not active

时间:2019-10-31
本文章向大家介绍was not registered for synchronization because synchronization is not active,主要包括was not registered for synchronization because synchronization is not active使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

转:

SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4529fa91]

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/yangfengjueqi/article/details/85246411

控制台日志如下

  1. DEBUG - Creating a new SqlSession
  2. DEBUG - SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4529fa91] was not registered for synchronization because synchronization is not active
  3. DEBUG - Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@4529fa91]

并没有看出错误原因是什么,可以断定是SQL语句那里的,随即在SQL语句上加上try catch查看

  1. try {
  2. dao.saveWithKey("com.test.mapper.SingleWindowVehicleMapper.addSheet2", body);
  3. } catch (Exception e) {
  4. e.printStackTrace();
  5. }

catch查看异常如下

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'createDate != null''. Cause: org.apache.ibatis.ognl.ExpressionSyntaxException: Malformed OGNL expression: createDate != null' [org.apache.ibatis.ognl.TokenMgrError: Lexical error at line 1, column 20.  Encountered: <EOF> after : ""]

检查mapper.xml果然这里有问题

<if test="createDate != null'">#{createDate},</if>

原文地址:https://www.cnblogs.com/libin6505/p/11770939.html