There is no getter for property named 'NULL' in ……


 往往細節上的錯誤事最要命的事情,當你看着代碼,邏輯上沒有問題,但是卻又曝出一些莫名其妙不知所以的錯,你百度了

說出來的原因又是亂七八糟的雞肋!很無助,糾結了很久,浪費了很多寶貴的時間……看代碼!

<update id="Updateuser2" parameterType="User">
        update 
        ckx_user
        <set>
            <if test="userName != NULL">
                userName=#{userName},
            </if>
            <if test="passWord != NULL">
                passWord=#{passWord}
            </if>
        </set>
        where 
        userId=#{userId}
    </update>

看這段代碼,一小段,加上錯誤提示,你應該可以悟得到!但是在碼海你能在短時間發現,你厲害!

沒錯!<if test="userName != NULL">我一直沒看出來錯誤,userName != NULL,現在不是對空的判斷了!而是是否等於NULL這個字符串

太扯淡了!一直報錯:Error updating database.  Cause: org.apache.ibatis.reflection.ReflectionException:

他說錯誤的跟新數據!操蛋的人生不需要解釋!看改后!

<update id="Updateuser2" parameterType="User">
        update 
        ckx_user
        <set>
            <if test="userName != null">
                userName=#{userName},
            </if>
            <if test="passWord != null">
                passWord=#{passWord}
            </if>
        </set>
        where 
        userId=#{userId}
    </update>

編譯通過!運行正常!這是耽誤了我一個晚上的事情。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM