[
http://issues.apache.org/jira/browse/IBATIS-261?page=comments#action_12367161 ]
Arne Burmeister commented on IBATIS-261:
----------------------------------------
The update SqlMap is very simple, the problem also occurs on insert - seems to
be a general Problem
<update id="updateItemPosition" parameterClass="com.x.Item">
update item
set
pos = #position:NUMERIC#
where
id = #id:NUMERIC#
</update>
The wrapping Spring-Code is as follows:
com.ibatis.sqlmap.client.SqlMapSession session =
this.sqlMapClient.openSession();
try {
java.sql.Connection con =
DataSourceUtils.getConnection(getDataSource());
try {
session.setUserConnection(con);
return action.doInSqlMapClient(session);
}
catch (SQLException ex) {
throw
getExceptionTranslator().translate("SqlMapClient operation", null, ex);
}
finally {
DataSourceUtils.releaseConnection(con,
getDataSource());
}
}
finally {
session.close();
}
> CLONE -The method executor.executeBatch() always returns 0.
> -----------------------------------------------------------
>
> Key: IBATIS-261
> URL: http://issues.apache.org/jira/browse/IBATIS-261
> Project: iBatis for Java
> Type: Bug
> Components: SQL Maps
> Versions: 2.1.0
> Environment: SUN JVM 1.4.2 On Windows
> Reporter: Arne Burmeister
>
> I am using Sql Maps 2.1.5 with Spring 1.2.4.
> I have a method as following.
> I want to get the number of rows updated in the batch .
> But it always returns 0.
> public int insertBatchError(final List batchErrorList) {
> Integer count = (Integer) getSqlMapClientTemplate().execute(new
> SqlMapClientCallback() {
> public Object doInSqlMapClient(SqlMapExecutor executor) throws
> SQLException {
> executor.startBatch();
> for (int i = 0; i < batchErrorList.size(); i++) {
> BatchErrorDTO batchErrorDto = (BatchErrorDTO)
> batchErrorList.get(i);
> executor.update("insertBatchError", batchErrorDto);
> }
> int count = executor.executeBatch();
> return new Integer(count);
> }
> });
>
> return count.intValue();
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira