caused by:org.apache.ibatis.ognl.OgnlException:source is null for getProperty (NULL, "mil_id")

Source: Internet
Author: User

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")

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.