今天在使用mybatis处理数据库的时候,突然抛出了上述异常,让我感到很惊讶,因为在处理save的时候,在Mybatis的配置文件中,我根本就没有使用到ognl表达式,系统怎么会抛出上述异常。而且之前也是这么使用的,也没见抛出上述异常。然后查看操作数据库的Mybatis的配置文件,倒是找到了几个错误,但是都不是引起这个异常的原因。然后,再仔细查看这个配置文件,突然之间,发现了,在该配置文件:

  1. <!-- save -->
  2. <insert id="save">
  3. insert into qa_sampling(s_id ,
  4. s_mil_id ,
  5. s_samplingPackage ,
  6. s_samplingWeight ,
  7. s_samplingPerson_id ,
  8. s_samplingCardFill ,
  9. s_samplingDate ,
  10. s_createTime)
  11. values(#{s_id} ,
  12. ${s_mil.mil_id} ,
  13. #{s_samplingPackage} ,
  14. #{s_samplingWeight} ,
  15. #{s_samplingPerson.u_id} ,
  16. #{s_samplingCardFill} ,
  17. #{s_samplingDate} ,
  18. #{s_createTime})
  19. </insert>

${s_mil.mil_id} , 这一处,居然是使用$,难怪系统将其作为表达式进行解析,将其修改成”#”之后,一切OK,上述异常成功解决。现,贴出正确的写法:

  1. <!-- save -->
  2. <insert id="save">
  3. insert into qa_sampling(s_id ,
  4. s_mil_id ,
  5. s_samplingPackage ,
  6. s_samplingWeight ,
  7. s_samplingPerson_id ,
  8. s_samplingCardFill ,
  9. s_samplingDate ,
  10. s_createTime)
  11. values(#{s_id} ,
  12. #{s_mil.mil_id} ,
  13. #{s_samplingPackage} ,
  14. #{s_samplingWeight} ,
  15. #{s_samplingPerson.u_id} ,
  16. #{s_samplingCardFill} ,
  17. #{s_samplingDate} ,
  18. #{s_createTime})
  19. </insert>

Caused by: org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "mil_id")的更多相关文章

  1. root cause org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "XXX")

    在执行一个查询语句的时候,mybatis报错:root cause org.apache.ibatis.ognl.OgnlException: source is null for getProper ...

  2. org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "enterpCd")-Mybatis报错

    一.问题由来 下午快要下班时,登录测试服务器查看日志信息,看看有没有新的异常信息,如果有的话好及时修改.结果一看果然有新的异常信息. 主要的异常信息如下: 2020-10-13 14:51:03,03 ...

  3. 解决:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'requestMap.maintenancename != null and requestMap.maintenance

    异常如下:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.Builde ...

  4. source is null for getProperty(null, "cpmodel")异常结局

    org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderExce ...

  5. Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'zoneId' in 'class java.lang.String'

    本文为博主原创,未经允许不得而转载: 异常展示: dao层定义的接口为: public int getClientTotal(); 在mybatis中的sql为: <select id=&quo ...

  6. Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'company' in 'class java.lang.String'

    Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named ' ...

  7. [mybatis错误] - sql出错 org.apache.ibatis.ognl.ParseException: Encountered "!" at line 1, column 15. Was expecting one of:

    完整异常:Caused by: org.apache.ibatis.builder.BuilderException: Error evaluating expression 'developerTy ...

  8. Caused by: org.apache.ibatis.reflection.ReflectionException我碰到的情况,原因不唯一

    映射文件: <select id="selectKeyByUserId"  resultMap="Xxx">        <![CDATA[ ...

  9. Caused by: org.apache.ibatis.binding.BindingException: Parameter 'parameter' not found.解决

    Caused by: org.apache.ibatis.binding.BindingException: Parameter 'company' not found. Available para ...

随机推荐

  1. poj Organize Your Train part II

    http://poj.org/problem?id=3007 #include<cstdio> #include<algorithm> #include<cstring& ...

  2. MFC浅析(4) CObject浅析

    MFC CObject浅析 1.CObject简要声明 2.CRuntimeClass结构 3.RUNTIME_CLASS 4.DYNAMIC支持 5.DYNCREATE支持 6.SERIAL支持 C ...

  3. CentOS 6.5 安装realtek RTL8188CE无线网卡

    首先,要检查一下网络适配器的型号. [root@localhost sam]# lspci -nn | grep -i net03:00.0 Ethernet controller [0200]: R ...

  4. SherlockActivity也可以用依赖注入的方法:

    场景:     一个Activity必须继承RoboActivity才可以使用依赖注入. 若一个Activity已经继承了别的Activity了.比如SherlockActivity 如何才能使用依赖 ...

  5. H - Can you answer these queries? - (区间查询更新)

    有一列数,(都是2^63范围内的并且都大于0的整数),现在呢有一些操作, 操作 0 可以把区间LR内的所有数都变成它的平方根数(是取整后的),操作 1 可以就是求区间LR内的和了. 分析:因为这个操作 ...

  6. Nodejs 上传下载功能的实现(同步)

    上传和下载可分为两种,一种是form表单的形式(同步),另一种是Ajax的形式(异步). 示例一(form表单): html代码如下: <!DOCTYPE html> <html&g ...

  7. javascript 判断是否是数组

    function isArray(object){ return object && typeof object==='object' && typeof object ...

  8. Maven assembly插件输出文件乱码问题

    使用Maven的<artifactId>maven-assembly-plugin</artifactId>插件导致输出的XML配置文件源文件的中文注释变成乱码,排查了多个地方 ...

  9. linux经常使用命令

    linux经常使用命令 pwd 查看当前工作文件夹的绝对路径 cat input.txt 查看input.txt文件的内容 ls 显示当前文件夹下全部的文件及子文件夹 rm recommender-d ...

  10. 云平台编程与开发(七)-使用X5Cloud云平台开发网络彩讯

    云平台编程与开发(七)-使用X5Cloud云平台开发网络彩讯 博客分类: 云平台 云计算 Java Android Android 云平台 Java 网络彩讯定义以及工作大概流程  下载试用地址:ap ...