java preparedstatement executeUpdate return 错误影响行

java preparedstatement executeUpdate return wrong affected rows

我使用 spring jdbctemplate 来更新一些行,但是我得到了这个日志 message.Two 完全相同 sql returns 不同的影响 rows.There 是不可能的第二个更新操作 returns 0 受影响 rows.I 只是想不通。

2015-12-03 12:37:37 [INFO] [qtp683362635-1187] c.t.s.c.i.d.IDGJdbcDao - update:

update JCSZ..T_IDG
   set N_VALUE = ?
 where C_BusinessID = ?
   and C_ComID = ?
   and C_RateID = ?
   and N_TYPE = ?
   and N_ConfType = ?

受影响 rows:373 行

        2015-12-03 12:37:38 [INFO] [qtp683362635-746] c.t.s.c.i.d.IDGJdbcDao - update:
update JCSZ..T_IDG
   set N_VALUE = ?
 where C_BusinessID = ?
   and C_ComID = ?
   and C_RateID = ?
   and N_TYPE = ?
   and N_ConfType = ?

受影响 rows:0 行

做一些研究(询问 google)我在 UPDATE WITH RETURNING 上发现了一些提示,只给了你实际改变的行数。至少这应该是以下行为:

我假设它也适用于其他数据库系统。

因此,当执行两次完全相同的更新查询时,您的结果正是应该发生的结果。第一次一切都改变了,返回找到的行数,第二次什么都没有改变,给你 0.