Caused by: org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "mil_id")
今天在使用mybatis处理数据库的时候,突然抛出了上述异常,让我感到很惊讶,因为在处理save的时候,在Mybatis的配置文件中,我根本就没有使用到ognl表达式,系统怎么会抛出上述异常。而且之前也是这么使用的,也没见抛出上述异常。然后查看操作数据库的Mybatis的配置文件,倒是找到了几个错误,但是都不是引起这个异常的原因。然后,再仔细查看这个配置文件,突然之间,发现了,在该配置文件:
<!-- save -->
<insert id="save">
insert into qa_sampling(s_id ,
s_mil_id ,
s_samplingPackage ,
s_samplingWeight ,
s_samplingPerson_id ,
s_samplingCardFill ,
s_samplingDate ,
s_createTime)
values(#{s_id} ,
${s_mil.mil_id} ,
#{s_samplingPackage} ,
#{s_samplingWeight} ,
#{s_samplingPerson.u_id} ,
#{s_samplingCardFill} ,
#{s_samplingDate} ,
#{s_createTime})
</insert>
${s_mil.mil_id} , 这一处,居然是使用$,难怪系统将其作为表达式进行解析,将其修改成”#”之后,一切OK,上述异常成功解决。现,贴出正确的写法:
<!-- save -->
<insert id="save">
insert into qa_sampling(s_id ,
s_mil_id ,
s_samplingPackage ,
s_samplingWeight ,
s_samplingPerson_id ,
s_samplingCardFill ,
s_samplingDate ,
s_createTime)
values(#{s_id} ,
#{s_mil.mil_id} ,
#{s_samplingPackage} ,
#{s_samplingWeight} ,
#{s_samplingPerson.u_id} ,
#{s_samplingCardFill} ,
#{s_samplingDate} ,
#{s_createTime})
</insert>
Caused by: org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "mil_id")的更多相关文章
- 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 ...
- org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "enterpCd")-Mybatis报错
一.问题由来 下午快要下班时,登录测试服务器查看日志信息,看看有没有新的异常信息,如果有的话好及时修改.结果一看果然有新的异常信息. 主要的异常信息如下: 2020-10-13 14:51:03,03 ...
- 解决: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 ...
- source is null for getProperty(null, "cpmodel")异常结局
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderExce ...
- 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 ...
- 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 ' ...
- [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 ...
- Caused by: org.apache.ibatis.reflection.ReflectionException我碰到的情况,原因不唯一
映射文件: <select id="selectKeyByUserId" resultMap="Xxx"> <![CDATA[ ...
- Caused by: org.apache.ibatis.binding.BindingException: Parameter 'parameter' not found.解决
Caused by: org.apache.ibatis.binding.BindingException: Parameter 'company' not found. Available para ...
随机推荐
- Swift互用性:与 Objective-C 的 API 交互(Swift 2.0版更新)-备
本页包含内容: 初始化 可失败初始化 访问属性 方法 id 兼容性(id Compatibility) 空值和可选值 扩展(Extensions) 闭包(Closures) 比较对象 Swift 类型 ...
- sphinx coreseek SetSortMode(SPH_SORT_ATTR_ASC, '') 对float 排序设置bug
when I use SetSortMode(SPH_SORT_ATTR_ASC, 'floatVar'), it works unexpectedly. for example, I have a ...
- CentOS 7 ARM 版发布:支持树莓派2/香蕉派/CubieTruck
CentOS 7 ARM 版发布:支持树莓派2/香蕉派/CubieTruck 来自CentOS团队的Karanbir Singh很高兴地宣布,面向ARM硬件架构的CentOS 7 Linux已经正式发 ...
- COJ 1006 树上操作
传送门:http://oj.cnuschool.org.cn/oj/home/problem.htm?problemID=979 WZJ的数据结构(六) 难度级别:D: 运行时间限制:1000ms: ...
- 输入一个单向链表,输出该链表中倒数第K个结点
输入一个单向链表,输出该链表中倒数第K个结点,具体实现如下: #include <iostream> using namespace std; struct LinkNode { publ ...
- SPFA 最短路径打印方法
#include <iostream> #include <cstdlib> #include <cstdio> #include <algorithm> ...
- HDOJ的题目分类
模拟题, 枚举 1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 10 ...
- doxygen学习笔记
下载doxygen:http://www.cnblogs.com/duxiuxing/p/4301015.html 学习思路 doxygen能够根据代码和注释生成文档.可想而知,doxygen对注释的 ...
- POJ2533 Longest ordered subsequence
Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 41984 Acc ...
- linux是一种修行
或许我当初开始学习linux是因为我在了解嵌入式的时候,查到的资料,说linux是最好的系统,那时可能自己太嫩了,自己就信了,直到最近这几天我才被ubuntu折腾的要死,就是一个环境变量,我折腾怀了我 ...