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 ...
随机推荐
- EventSystem
Unity5.0 EventSystem事件系统的详细说明 一.EventSystem对象的说明 当我们在场景中创建任一UI对象后,Hierarchy面板中都可以看到系统自动创建了对象EventSys ...
- MVC form post 传值
http://www.cnblogs.com/firstcsharp/archive/2013/08/05/3238321.html @using (Html.BeginForm())参数示例 MVC ...
- 软硬大比拼 硅胶、TPU和PC材质对比
手机保护壳的材质有很多种,目前保护壳市场上最为常见的就是硅胶.TPU.PC材质了.那么我们不禁要问,PU.硅胶.PC三材质到底有哪些区别呢?普通消费者在购买保护壳的时候能否从外表就能看出保护壳材质?P ...
- BZOJ 1034 [ZJOI2008]泡泡堂BNB
1034: [ZJOI2008]泡泡堂BNB Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 1757 Solved: 928[Submit][Sta ...
- 【贪心】XMU 1061 Ckp的约会
题目链接: http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1061 题目大意: n个任务(n<=1000),给定名字和开始.结束时间,求最多能 ...
- UVALive 6198 A Terribly Grimm Problem
题目大意是 给出L,H 10^10范围 为[L, H]这个连续的整数区间寻找一个序列. 序列的长度要跟[L, H]一样 然后序列中的数都是素数,并且互不相同 并且序列中第i个数 要求是L + ...
- 在sql语句中使用plsql变量
示例代码如下: create or replace type ua_id_table is table of number; declare v_tab ua_id_table;begin v_tab ...
- Struts2初学习记录
以下笔记内容来自尚硅谷_Struts2_佟刚老师的视频教程+自己一点点整理 来源免责声明 一. 1. VS 自实现: 1). 搭建 Struts2 的开发环境 2). 不需要显式的定义 Filter, ...
- 百度地图点聚合MarkerClusterer,性能优化
参考文献:http://www.cnblogs.com/lightnull/p/6184867.html 百度的点聚合算法 是基于方格和距离的聚合算法,即开始的时候地图上没有任何已知的聚合点,然后遍历 ...
- jQuery实现密保互斥问题
密保互斥问题: 密保通常都会有n个问题,让用户选择其中2.3个,而且都不会让用户选择重复的问题.这就要求密保互斥. 效果如下: 下面我用了jquery实现密保互斥,用于解决密保,投票等类似互斥问题,可 ...