【发布时间】:2014-11-12 12:36:07
【问题描述】:
下面使用 ibatis xml 提到了我的原始查询: 数据库记录未更新。
<update>
update
nest set
nstatus = #status#
where
nestid =
#nestId# and (nstatus != #deviceStatus# OR nstatus IS NULL)
</update>
但是java SQL准备以下查询我的日志如下。
DEBUG java.sql.Connection - {conn-100103} Preparing Statement: update nest set nstatus = ? where nestid = ? and nstatus != ? or nstatus = NULL
DEBUG java.sql.PreparedStatement - {pstm-100104} Executing Statement: update nest set nstatus = ? where nestid = ? and nstatus != ? or nstatus = NULL
DEBUG java.sql.PreparedStatement - {pstm-100104} Parameters: [Apple, 150495, Device]
DEBUG java.sql.PreparedStatement - {pstm-100104} Types: [java.lang.String, java.lang.Integer, java.lang.String]
我正在使用 mysql Db 更新记录,它接受以下更新查询。(= null) is not accepting in mysql while updating records 和 (IS NULL) is acceptable to update records
语句应该是这样的:
update nest set nstatus = ? where nestid = ? and nstatus != ? or nstatus IS NULL
请告诉我解决方案,我应该在我的 ibatis 更新声明中做哪些更改。
【问题讨论】:
标签: mysql spring mybatis ibatis