org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: Error evaluating expression 'programa.pId != null'. Cause: org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "pId")
------------------------------------------------------
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@68a32861] was not registered for synchronization because synchronization is not active
------------------------------------------------------
Caused by: org.apache.ibatis.builder.BuilderException: Error evaluating expression 'programa.pId != null'. Cause: org.apache.ibatis.ognl.OgnlException: source is null for getProperty(null, "pId")
最开始删除的方法没有try不知道错在哪里也没抛异常
动态拼接的时候最开始用的只是根据programa.pId做条件删除,所有本身Article对象的aId属性是为空的,删除的时候没有问题。
<if test="aId != null ">and a_id=#{aId} </if>
<if test="programa.pId != null" > and p_id=#{programa.pId} </if>
当我根据aId来删除的时候,条件还是↓↓↓↓
<if test="aId != null ">and a_id=#{aId} </if>
<if test="programa.pId != null" > and p_id=#{programa.pId} </if>
到这里的时候就怎么也不执行删除的sql,代码还是接着运行,发现是因为没有判断对象属性不为空
一次泪奔的总结┭┮﹏┭┮
评论 (0)