Jquery 更新数据库时出错!表或视图不存在
我有这个疑问Jquery 更新数据库时出错!表或视图不存在,jquery,database,mybatis,Jquery,Database,Mybatis,我有这个疑问 <update id="updateRow"> update ROW set DISPLAY_ID = #{displayId} <where> <include refid="rowCriteria" /> </where> </update> <sql id="rowCriteria"> <if test="criteria.
<update id="updateRow">
update
ROW
set
DISPLAY_ID = #{displayId}
<where>
<include refid="rowCriteria" />
</where>
</update>
<sql id="rowCriteria">
<if test="criteria.displayId} != null">
DISPLAY_ID=#{criteria.displayId}
</if>
<if test="criteria.id != null">
and ID=#{criteria.id}
</if>
</sql>
我得到这个错误
该错误可能涉及defaultParameterMap
设置参数时出错
SQL:更新行集显示\u ID=?其中ID=?
原因:java.sql.SQLSyntaxErrorException:ORA-00942:表或视图不存在
但如果我从标准ID中删除“and”
<sql id="rowCriteria">
<if test="criteria.displayId} != null">
DISPLAY_ID=#{criteria.displayId}
</if>
<if test="criteria.id != null">
ID=#{criteria.id}
</if>
</sql>
DISPLAY_ID=#{criteria.displayId}
ID=#{criteria.ID}
查询将正确运行并执行更新
我的问题是,如果我在条件中有和键,为什么有时更新会正确运行,有时我会出现错误?两件事:
- 删除多余的
}
- 在每个条件前面加上
和
。
标记将始终删除第一个标记 和DISPLAY_ID=#{criteria.displayId} 和ID=#{criteria.ID}
和
,因此删除和
是没有帮助的。在有和
或没有和
的情况下,查询打印是相同的更新行集显示\u ID=?其中ID=代码>是可以的,但是如果条件有和
的话,我会得到那个错误。这就是为什么我觉得很奇怪。我认为这可能是一个配置问题,但我仍然找不到解决方案。需要两个案例的mybatis日志,以及两个案例的完整配置。您写道,您“仅”删除了和
,但
的定义不仅在和
中有所不同,因此有些内容仍然不匹配。
<sql id="rowCriteria">
<if test="criteria.displayId} != null">
DISPLAY_ID=#{criteria.displayId}
</if>
<if test="criteria.id != null">
ID=#{criteria.id}
</if>
</sql>