Spring JdbcTemplate batchUpdate问题总是返回-3

时间:2013-05-01 15:36:24

标签: spring jdbctemplate batch-updates

我正在尝试在Springs jdbcTemplate上使用batchUpdate但是我回来的是一个-3的int数组。下面是我正在运行的代码。数组列表“批处理”包含插入和更新。

String[] stmts = batch.toArray(new String[batch.size()]);
int[] result = jdbcTemplate.batchUpdate(stmts);

结果数组包含     [-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,...]

使用   - 春季3.1.2.RELEASE   - jtds驱动程序1.3.0   - SQL Server 2005

有没有人遇到过这个?

1 个答案:

答案 0 :(得分:1)

发现batchUpdate不喜欢它给出的sql中的注释。删除评论后,更新工作正常。