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>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM