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

控制檯日誌如下

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

並沒有看出錯誤原因是什麼,可以斷定是SQL語句那裏的,隨即在SQL語句上加上try catch查看

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

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>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章