Today, when using MyBatis to process the database, I was surprised to throw out the above exception, because in the process of save, in the MyBatis configuration file, I simply did not use the OGNL expression, the system how to throw the above exception. It was also used before and did not see the exception being thrown. Then look at the MyBatis configuration file of the operational database, but I found a few errors, but none of them are the cause of the exception. Then, looking closely at this profile, all of a sudden, it was found in that configuration file:
<!--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}, this place, incredibly use $, it is no wonder that the system to parse it as an expression, modify it to "#" After all OK, the above exception successfully resolved. Now, put out the correct wording:
<!--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")